20
20
#include " ClangTidyModuleRegistry.h"
21
21
#include " ClangTidyProfiling.h"
22
22
#include " ExpandModularHeadersPPCallbacks.h"
23
+ #include " clang-tidy-config.h"
23
24
#include " clang/AST/ASTConsumer.h"
24
25
#include " clang/AST/ASTContext.h"
25
26
#include " clang/AST/Decl.h"
26
27
#include " clang/ASTMatchers/ASTMatchFinder.h"
27
- #include " clang/Config/config.h"
28
28
#include " clang/Format/Format.h"
29
29
#include " clang/Frontend/ASTConsumers.h"
30
30
#include " clang/Frontend/CompilerInstance.h"
47
47
#include < algorithm>
48
48
#include < utility>
49
49
50
- #if CLANG_ENABLE_STATIC_ANALYZER
50
+ #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
51
51
#include " clang/Analysis/PathDiagnostic.h"
52
52
#include " clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
53
- #endif // CLANG_ENABLE_STATIC_ANALYZER
53
+ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
54
54
55
55
using namespace clang ::ast_matchers;
56
56
using namespace clang ::driver;
@@ -63,7 +63,7 @@ namespace clang {
63
63
namespace tidy {
64
64
65
65
namespace {
66
- #if CLANG_ENABLE_STATIC_ANALYZER
66
+ #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
67
67
static const char *AnalyzerCheckNamePrefix = " clang-analyzer-" ;
68
68
69
69
class AnalyzerDiagnosticConsumer : public ento ::PathDiagnosticConsumer {
@@ -95,7 +95,7 @@ class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
95
95
private:
96
96
ClangTidyContext &Context;
97
97
};
98
- #endif // CLANG_ENABLE_STATIC_ANALYZER
98
+ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
99
99
100
100
class ErrorReporter {
101
101
public:
@@ -324,7 +324,7 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
324
324
}
325
325
}
326
326
327
- #if CLANG_ENABLE_STATIC_ANALYZER
327
+ #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
328
328
static void setStaticAnalyzerCheckerOpts (const ClangTidyOptions &Opts,
329
329
AnalyzerOptionsRef AnalyzerOptions) {
330
330
StringRef AnalyzerPrefix (AnalyzerCheckNamePrefix);
@@ -369,7 +369,7 @@ static CheckersList getAnalyzerCheckersAndPackages(ClangTidyContext &Context,
369
369
}
370
370
return List;
371
371
}
372
- #endif // CLANG_ENABLE_STATIC_ANALYZER
372
+ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
373
373
374
374
std::unique_ptr<clang::ASTConsumer>
375
375
ClangTidyASTConsumerFactory::CreateASTConsumer (
@@ -424,7 +424,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
424
424
if (!Checks.empty ())
425
425
Consumers.push_back (Finder->newASTConsumer ());
426
426
427
- #if CLANG_ENABLE_STATIC_ANALYZER
427
+ #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
428
428
AnalyzerOptionsRef AnalyzerOptions = Compiler.getAnalyzerOpts ();
429
429
AnalyzerOptions->CheckersAndPackages = getAnalyzerCheckersAndPackages (
430
430
Context, Context.canEnableAnalyzerAlphaCheckers ());
@@ -440,7 +440,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
440
440
new AnalyzerDiagnosticConsumer (Context));
441
441
Consumers.push_back (std::move (AnalysisConsumer));
442
442
}
443
- #endif // CLANG_ENABLE_STATIC_ANALYZER
443
+ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
444
444
return std::make_unique<ClangTidyASTConsumer>(
445
445
std::move (Consumers), std::move (Profiling), std::move (Finder),
446
446
std::move (Checks));
@@ -453,11 +453,11 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
453
453
CheckNames.emplace_back (CheckFactory.getKey ());
454
454
}
455
455
456
- #if CLANG_ENABLE_STATIC_ANALYZER
456
+ #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
457
457
for (const auto &AnalyzerCheck : getAnalyzerCheckersAndPackages (
458
458
Context, Context.canEnableAnalyzerAlphaCheckers ()))
459
459
CheckNames.push_back (AnalyzerCheckNamePrefix + AnalyzerCheck.first );
460
- #endif // CLANG_ENABLE_STATIC_ANALYZER
460
+ #endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
461
461
462
462
llvm::sort (CheckNames);
463
463
return CheckNames;
0 commit comments