[clang-scan-deps] Support for clang --analyze in clang-scan-deps
authorJan Korous <jkorous@apple.com>
Mon, 14 Oct 2019 20:15:01 +0000 (20:15 +0000)
committerJan Korous <jkorous@apple.com>
Mon, 14 Oct 2019 20:15:01 +0000 (20:15 +0000)
commitc5d14b5c6fa9e003ef2037dcd3601c8339b1e42f
treea57626e41231766bbe747d3df24cb04f6928e7bd
parent7e385bd2f526cc04b4a7cc6af1f39744f304d31a
[clang-scan-deps] Support for clang --analyze in clang-scan-deps

The goal is to have 100% fidelity in clang-scan-deps behavior when
--analyze is present in compilation command.

At the same time I don't want to break clang-tidy which expects
__static_analyzer__ macro defined as built-in.

I introduce new cc1 options (-setup-static-analyzer) that controls
the macro definition and is conditionally set in driver.

Differential Revision: https://reviews.llvm.org/D68093

llvm-svn: 374815
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Lex/PreprocessorOptions.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/test/Analysis/preprocessor-setup.c [new file with mode: 0644]
clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json [new file with mode: 0644]
clang/test/ClangScanDeps/static-analyzer.c [new file with mode: 0644]
llvm/utils/lit/lit/llvm/config.py