aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorVictor Chernyakin <chernyakin.victor.j@outlook.com>2025-07-09 05:05:42 -0700
committerGitHub <noreply@github.com>2025-07-09 20:05:42 +0800
commitb041a589891e07fc4c6fe38e12faed17e2633c55 (patch)
tree9fe47cc03a9e085ae1448c143555424fff0aaae4 /clang/lib/Frontend/CompilerInstance.cpp
parent62e537ae4fc3ea2ea087847b02543e619b24470b (diff)
downloadllvm-b041a589891e07fc4c6fe38e12faed17e2633c55.zip
llvm-b041a589891e07fc4c6fe38e12faed17e2633c55.tar.gz
llvm-b041a589891e07fc4c6fe38e12faed17e2633c55.tar.bz2
[clang-tidy][NFC] concat static-analyzer name at compilation time (#147406)
```cpp for (std::string OptionName : { #define GET_CHECKER_OPTIONS #define CHECKER_OPTION(TYPE, CHECKER, OPTION_NAME, DESCRIPTION, DEFAULT, \ RELEASE, HIDDEN) \ Twine(AnalyzerCheckNamePrefix).concat(CHECKER ":" OPTION_NAME).str(), #include "clang/StaticAnalyzer/Checkers/Checkers.inc" #undef CHECKER_OPTION #undef GET_CHECKER_OPTIONS }) { Result.Options.insert(OptionName); } ``` This code is doing a lot of unnecessary work at runtime. For each of the (currently) 59 checker options, it runs `Twine(AnalyzerCheckNamePrefix).concat(CHECKER ":" OPTION_NAME).str(),`, which allocates a string (all of this is unrolled, leading to code bloat). Then it copies all those strings (because `std::string OptionName`, not `const std::string& OptionName`). All of this can be done at compile time!
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
0 files changed, 0 insertions, 0 deletions