1 //===--- MoveConstructorInitCheck.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_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H 11 12 #include "../ClangTidyCheck.h" 13 #include "../utils/IncludeInserter.h" 14 15 #include <memory> 16 17 namespace clang { 18 namespace tidy { 19 namespace performance { 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/performance-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(const SourceManager &SM, Preprocessor *PP, 32 Preprocessor *ModuleExpanderPP) 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