clang-tools  3.8.0
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
27 public:
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
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
StringHandle Name
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:188
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
Base class for all clang-tidy checks.
Definition: ClangTidy.h:102
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
std::map< std::string, std::string > OptionMap
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
ClangTidyContext & Context
Definition: ClangTidy.cpp:93
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void registerPPCallbacks(clang::CompilerInstance &Compiler) override
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
const NamedDecl * Result
Definition: USRFinder.cpp:121