Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:21

0001 //===--- InefficientStringConcatenationCheck.h - clang-tidy-----------*- C++
0002 //-*-===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H
0011 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H
0012 
0013 #include "../ClangTidyCheck.h"
0014 
0015 namespace clang::tidy::performance {
0016 
0017 /// This check is to warn about the performance overhead arising from
0018 /// concatenating strings, using the operator+, instead of operator+=.
0019 ///
0020 /// For the user-facing documentation see:
0021 /// http://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-string-concatenation.html
0022 class InefficientStringConcatenationCheck : public ClangTidyCheck {
0023 public:
0024   InefficientStringConcatenationCheck(StringRef Name,
0025                                       ClangTidyContext *Context);
0026   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
0027     return LangOpts.CPlusPlus;
0028   }
0029   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
0030   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
0031   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
0032 
0033 private:
0034   const bool StrictMode;
0035 };
0036 
0037 } // namespace clang::tidy::performance
0038 
0039 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTSTRINGCONCATENATION_H