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 45