[PATCH] D44906: [clang-tidy] Define __clang_analyzer__ macro for clang-tidy for compatibility with clang static analyzer

Zinovy Nis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 08:52:14 PDT 2018


zinovy.nis added inline comments.


================
Comment at: clang-tidy/ClangTidy.cpp:490
+        CommandLineArguments AdjustedArgs = Args;
+        AdjustedArgs.emplace_back("-D__clang_analyzer__");
+        return AdjustedArgs;
----------------
alexfh wrote:
> I wonder whether we should instead reuse the logic in the frontend (tools/clang/lib/Frontend/InitPreprocessor.cpp:970). This could be done by overriding ActionFactory::runInvocation and setting FrontendOptions::ProgramAction to frontend::RunAnalysis there. WDYT?
Thanks. I know about this code. But I'm not sure that we can reuse RunAnalysys action hre - we need to parse AST only, but RunAnalysys does a lot of other things we dont' need. Is it correct?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D44906





More information about the cfe-commits mailing list