Skip to content

[clang-tidy][NFC] concat static-analyzer name at compilation time #147406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions clang-tools-extra/clang-tidy/ClangTidy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ namespace clang::tidy {

namespace {
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
#define ANALYZER_CHECK_NAME_PREFIX "clang-analyzer-"
static constexpr llvm::StringLiteral AnalyzerCheckNamePrefix =
"clang-analyzer-";
ANALYZER_CHECK_NAME_PREFIX;

class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
public:
Expand Down Expand Up @@ -669,18 +670,19 @@ getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
Buffer.append(AnalyzerCheck);
Result.Checks.insert(Buffer);
}
for (std::string OptionName : {

static constexpr llvm::StringLiteral OptionNames[] = {
#define GET_CHECKER_OPTIONS
#define CHECKER_OPTION(TYPE, CHECKER, OPTION_NAME, DESCRIPTION, DEFAULT, \
RELEASE, HIDDEN) \
Twine(AnalyzerCheckNamePrefix).concat(CHECKER ":" OPTION_NAME).str(),
ANALYZER_CHECK_NAME_PREFIX CHECKER ":" OPTION_NAME,

#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
#undef CHECKER_OPTION
#undef GET_CHECKER_OPTIONS
}) {
Result.Options.insert(OptionName);
}
};

Result.Options.insert_range(OptionNames);
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER

Context.setOptionsCollector(&Result.Options);
Expand Down