clang-tools 6.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
25 class InefficientStringConcatenationCheck : public ClangTidyCheck {
26 public:
27 InefficientStringConcatenationCheck(StringRef Name,
28 ClangTidyContext *Context);
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
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::performance::InefficientStringConcatenationCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: InefficientStringConcatenationCheck.cpp:30
clang::tidy::performance::InefficientStringConcatenationCheck::InefficientStringConcatenationCheck
InefficientStringConcatenationCheck(StringRef Name, ClangTidyContext *Context)
Definition: InefficientStringConcatenationCheck.cpp:25
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::performance::InefficientStringConcatenationCheck::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: InefficientStringConcatenationCheck.cpp:20
clang::tidy::performance::InefficientStringConcatenationCheck
This check is to warn about the performance overhead arising from concatenating strings, using the operator+, instead of operator+=.
Definition: InefficientStringConcatenationCheck.h:25
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:99
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::InefficientStringConcatenationCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: InefficientStringConcatenationCheck.cpp:71