This is v2 of https://reviews.llvm.org/D67938 which I reverted as it broke clang-tidy and there wasn't any nice fix.
The full list of goals here is:
- Support commands with --analyze in compilation database for clang-scan-deps.
- Keep the macro spelling in one place only.
- Don't break clang-tidy which relies on the fact that __clang_analyzer__ is defined as built-in macro. Otherwise it's treated as part of the input and exposed in diagnostics - specifically the test was failing because macros should be lowercase or uppercase depending on clang-tidy config.
Two things I'd appreciate feedback on:
- name for the new option
- preferences whether the option should be automatically set to true whenever cc1 action is RunAnalysis or whether it should always be set by driver in case input args contain --analyze
The name doesn't quite reflect what it does.