clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MoveConstructorInitCheck.h
Go to the documentation of this file.
1 //===--- MoveConstructorInitCheck.h - clang-tidy-----------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
12
13 #include "../ClangTidy.h"
14 #include "../utils/IncludeInserter.h"
15
16 #include <memory>
17
18 namespace clang {
19 namespace tidy {
20
21 /// The check flags user-defined move constructors that have a ctor-initializer
22 /// initializing a member or base class through a copy constructor instead of a
23 /// move constructor.
24 /// For the user-facing documentation see:
25 /// http://clang.llvm.org/extra/clang-tidy/checks/misc-move-constructor-init.html
26 class MoveConstructorInitCheck : public ClangTidyCheck {
27 public:
28 MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context);
29 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
30 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
31 void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
32 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
33
34 private:
35 void
36 handleMoveConstructor(const ast_matchers::MatchFinder::MatchResult &Result);
37 void
38 handleParamNotMoved(const ast_matchers::MatchFinder::MatchResult &Result);
39
40 std::unique_ptr<IncludeInserter> Inserter;
41 const IncludeSorter::IncludeStyle IncludeStyle;
42 const bool UseCERTSemantics;
43 };
44
45 } // namespace tidy
46 } // namespace clang
47
48 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
clang::tidy::MoveConstructorInitCheck
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
Definition: MoveConstructorInitCheck.h:26
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::IncludeSorter::IncludeStyle
IncludeStyle
Definition: IncludeSorter.h:26
Finder
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:188
clang::tidy::MoveConstructorInitCheck::MoveConstructorInitCheck
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
Definition: MoveConstructorInitCheck.cpp:41
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:102
clang::tidy::MoveConstructorInitCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition: MoveConstructorInitCheck.cpp:174
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:82
clang::tidy::MoveConstructorInitCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: MoveConstructorInitCheck.cpp:93
Context
ClangTidyContext & Context
Definition: ClangTidy.cpp:93
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:124
clang::tidy::MoveConstructorInitCheck::registerPPCallbacks
void registerPPCallbacks(clang::CompilerInstance &Compiler) override
Definition: MoveConstructorInitCheck.cpp:168
clang::tidy::MoveConstructorInitCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
Definition: MoveConstructorInitCheck.cpp:48
Result
const NamedDecl * Result
Definition: USRFinder.cpp:121