diff options
author | Jan Korous <jkorous@apple.com> | 2019-10-14 20:15:01 +0000 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-10-14 20:15:01 +0000 |
commit | 8d744a73b55b545f704906966e86cb28ede2423c (patch) | |
tree | c78f99442d865b08bf9c85fdf140a3da27ea5ee1 /include | |
parent | 7482cce8b874cc5b3b44720f7e9fcd34e98f38d4 (diff) | |
download | clang-8d744a73b55b545f704906966e86cb28ede2423c.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Driver/CC1Options.td | 2 | ||||
-rw-r--r-- | include/clang/Lex/PreprocessorOptions.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 66906fb862..e0974fbb5a 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -846,6 +846,8 @@ def preamble_bytes_EQ : Joined<["-"], "preamble-bytes=">, "covering the first N bytes of the main file">; def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">, 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).">; //===----------------------------------------------------------------------===// // OpenCL Options diff --git a/include/clang/Lex/PreprocessorOptions.h b/include/clang/Lex/PreprocessorOptions.h index aa62b9bb48..344afa8941 100644 --- a/include/clang/Lex/PreprocessorOptions.h +++ b/include/clang/Lex/PreprocessorOptions.h @@ -181,6 +181,9 @@ public: ExcludedPreprocessorDirectiveSkipMapping *ExcludedConditionalDirectiveSkipMappings = nullptr; + /// Set up preprocessor for RunAnalysis action. + bool SetUpStaticAnalyzer = false; + public: PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {} |