clang-tools  4.0.0
InefficientStringConcatenationCheck.h
Go to the documentation of this file.
1 //===--- InefficientStringConcatenationCheck.h - clang-tidy-----------*- C++
2 //-*-===//
3 //
4 // The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H
12 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H
13 
14 #include "../ClangTidy.h"
15 
16 namespace clang {
17 namespace tidy {
18 namespace performance {
19 
20 /// This check is to warn about the performance overhead arising from
21 /// concatenating strings, using the operator+, instead of operator+=.
22 ///
23 /// For the user-facing documentation see:
24 /// http://clang.llvm.org/extra/clang-tidy/checks/performance-inefficient-string-concatenation.html
26 public:
29  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
30  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
31  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
32 
33 private:
34  const bool StrictMode;
35 };
36 
37 } // namespace performance
38 } // namespace tidy
39 } // namespace clang
40 
41 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H
const std::string Name
Definition: USRFinder.cpp:164
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:262
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
This check is to warn about the performance overhead arising from concatenating strings, using the operator+, instead of operator+=.
std::map< std::string, std::string > OptionMap
ClangTidyContext & Context
Definition: ClangTidy.cpp:87
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
const NamedDecl * Result
Definition: USRFinder.cpp:162