Index: clang-tidy/ClangTidy.cpp =================================================================== --- clang-tidy/ClangTidy.cpp +++ clang-tidy/ClangTidy.cpp @@ -529,6 +529,15 @@ ActionFactory(ClangTidyContext &Context) : ConsumerFactory(Context) {} FrontendAction *create() override { return new Action(&ConsumerFactory); } + bool runInvocation(std::shared_ptr Invocation, + FileManager *Files, + std::shared_ptr PCHContainerOps, + DiagnosticConsumer *DiagConsumer) override { + Invocation->getFrontendOpts().ProgramAction = frontend::RunAnalysis; + return FrontendActionFactory::runInvocation( + Invocation, Files, PCHContainerOps, DiagConsumer); + } + private: class Action : public ASTFrontendAction { public: Index: test/clang-tidy/clang-tidy-__clang_analyzer__macro.cpp =================================================================== --- test/clang-tidy/clang-tidy-__clang_analyzer__macro.cpp +++ test/clang-tidy/clang-tidy-__clang_analyzer__macro.cpp @@ -0,0 +1,5 @@ +// RUN: clang-tidy %s -checks=-*,modernize-use-nullptr -- | count 0 + +#if !defined(__clang_analyzer__) +#error __clang_analyzer__ is not defined +#endif