[PATCH] D68093: [clang-scan-deps][static analyzer] Support for clang --analyze in scan-deps

Jan Korous via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 19:41:13 PDT 2019


jkorous marked an inline comment as done.
jkorous added inline comments.


================
Comment at: clang/include/clang/Driver/CC1Options.td:849
   HelpText<"include a detailed record of preprocessing actions">;
+def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">,
+  HelpText<"Set up preprocessor for static analyzer (done automatically when static analyzer is run).">;
----------------
NoQ wrote:
> jkorous wrote:
> > hiraditya wrote:
> > > The name doesn't quite reflect what it does.
> > `setup-pp-for-analyzer`? I'm open to suggestions.
> I actually suggest modifying the help text to something like "Behave as if the Static Analyzer is going to be invoked, even if it's not actually going to be invoked (for now this boils down to defining the __clang_analyzer__ macro)" and keep the flag name roughly the same. This is the actual purpose of the option, right? We don't need to specify what precisely takes place when the option is invoked because this may change in the future, but the contract will remain.
Sorry, there were quite a few changes in the patch and it deviated from the original idea. After the most recent one the description wouldn't be correct anymore - please take a look at `clang/lib/Driver/ToolChains/Clang.cpp` below.
The `-setup-static-analyzer` flag can be passed on its own to frontend (without `-analyze`) but if you pass `--analyze` to driver then both `-analyze` and `-setup-static-analyzer` are passed to frontend.
Passing just `-analyze` without `-setup-static-analyzer` to frontend would result in skipping the `__clang_analyzer__` macro definition.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68093/new/

https://reviews.llvm.org/D68093





More information about the llvm-commits mailing list