diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/ClangTidy.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/ClangTidy.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 21984aea0e8..91e8ebee136 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -33,6 +33,7 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PreprocessorOptions.h" #include "clang/Rewrite/Frontend/FixItRewriter.h" #include "clang/Rewrite/Frontend/FrontendActions.h" #include "clang/Tooling/Core/Diagnostic.h" @@ -539,10 +540,8 @@ runClangTidy(clang::tidy::ClangTidyContext &Context, FileManager *Files, std::shared_ptr<PCHContainerOperations> PCHContainerOps, DiagnosticConsumer *DiagConsumer) override { - // Explicitly set ProgramAction to RunAnalysis to make the preprocessor - // define __clang_analyzer__ macro. The frontend analyzer action will not - // be called here. - Invocation->getFrontendOpts().ProgramAction = frontend::RunAnalysis; + // Explicitly ask to define __clang_analyzer__ macro. + Invocation->getPreprocessorOpts().SetUpStaticAnalyzer = true; return FrontendActionFactory::runInvocation( Invocation, Files, PCHContainerOps, DiagConsumer); } |