clang-tools 6.0.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_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
12
13 #include "../ClangTidy.h"
14 #include "../utils/IncludeInserter.h"
15
16 #include <memory>
17
18 namespace clang {
19 namespace tidy {
20 namespace performance {
21
22 /// The check flags user-defined move constructors that have a ctor-initializer
23 /// initializing a member or base class through a copy constructor instead of a
24 /// move constructor.
25 /// For the user-facing documentation see:
26 /// http://clang.llvm.org/extra/clang-tidy/checks/performance-move-constructor-init.html
27 class MoveConstructorInitCheck : public ClangTidyCheck {
28 public:
29 MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context);
30 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
31 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
32 void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
33 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
34
35 private:
36 std::unique_ptr<utils::IncludeInserter> Inserter;
37 const utils::IncludeSorter::IncludeStyle IncludeStyle;
38 };
39
40 } // namespace performance
41 } // namespace tidy
42 } // namespace clang
43
44 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::utils::IncludeSorter::IncludeStyle
IncludeStyle
Supported include styles.
Definition: IncludeSorter.h:27
clang::tidy::performance::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:49
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::performance::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:103
clang::tidy::performance::MoveConstructorInitCheck
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
Definition: MoveConstructorInitCheck.h:27
clang::tidy::performance::MoveConstructorInitCheck::registerPPCallbacks
void registerPPCallbacks(clang::CompilerInstance &Compiler) override
Definition: MoveConstructorInitCheck.cpp:97
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:99
clang::tidy::performance::MoveConstructorInitCheck::MoveConstructorInitCheck
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
Definition: MoveConstructorInitCheck.cpp:24
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:104
clang::tidy::performance::MoveConstructorInitCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: MoveConstructorInitCheck.cpp:30