clang-tools
10.0.0
clang-tools-extra
clang-tidy
modernize
MakeUniqueCheck.h
Go to the documentation of this file.
1
//===--- MakeUniqueCheck.h - clang-tidy--------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_UNIQUE_H
10
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_UNIQUE_H
11
12
#include "
MakeSmartPtrCheck.h
"
13
14
namespace
clang
{
15
namespace
tidy {
16
namespace
modernize {
17
18
/// Replace the pattern:
19
/// \code
20
/// std::unique_ptr<type>(new type(args...))
21
/// \endcode
22
///
23
/// With the C++14 version:
24
/// \code
25
/// std::make_unique<type>(args...)
26
/// \endcode
27
class
MakeUniqueCheck
:
public
MakeSmartPtrCheck
{
28
public
:
29
MakeUniqueCheck
(StringRef
Name
,
ClangTidyContext
*Context);
30
31
protected
:
32
SmartPtrTypeMatcher
getSmartPointerTypeMatcher
()
const override
;
33
34
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
;
35
36
private
:
37
const
bool
RequireCPlusPlus14;
38
};
39
40
}
// namespace modernize
41
}
// namespace tidy
42
}
// namespace clang
43
44
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_UNIQUE_H
clang::tidy::modernize::MakeSmartPtrCheck::SmartPtrTypeMatcher
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
Definition:
MakeSmartPtrCheck.h:35
clang::tidy::modernize::MakeUniqueCheck
Replace the pattern:
Definition:
MakeUniqueCheck.h:27
clang::tidy::modernize::MakeUniqueCheck::getSmartPointerTypeMatcher
SmartPtrTypeMatcher getSmartPointerTypeMatcher() const override
Returns matcher that match with different smart pointer types.
Definition:
MakeUniqueCheck.cpp:23
MakeSmartPtrCheck.h
Name
static constexpr llvm::StringLiteral Name
Definition:
UppercaseLiteralSuffixCheck.cpp:27
clang::tidy::modernize::MakeUniqueCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Returns whether the C++ version is compatible with current check.
Definition:
MakeUniqueCheck.cpp:39
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition:
ApplyReplacements.h:27
clang::tidy::modernize::MakeUniqueCheck::MakeUniqueCheck
MakeUniqueCheck(StringRef Name, ClangTidyContext *Context)
Definition:
MakeUniqueCheck.cpp:17
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:77
clang::tidy::modernize::MakeSmartPtrCheck
Base class for MakeSharedCheck and MakeUniqueCheck.
Definition:
MakeSmartPtrCheck.h:24
Generated on Wed Mar 4 2020 13:09:40 for clang-tools by
1.8.13