clang-tools  10.0.0svn
MoveConstructorInitCheck.h
Go to the documentation of this file.
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
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
IncludeStyle
Supported include styles.
Definition: IncludeSorter.h:26
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
Override this to register PPCallbacks in the preprocessor.
Base class for all clang-tidy checks.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
The check flags user-defined move constructors that have a ctor-initializer initializing a member or ...
static constexpr llvm::StringLiteral Name
std::map< std::string, std::string > OptionMap
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.