diff options
author | Jan Korous <jkorous@apple.com> | 2019-11-07 13:56:14 -0800 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-11-07 14:06:43 -0800 |
commit | 03b84e4f6d0e1c04f22d69cc445f36e1f713beb4 (patch) | |
tree | 16c97f555ff1732509a31aabbf65e3fbf04c8791 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | ad3c9d46fe39af1762a7be75d754723be9a5594a (diff) | |
download | bcm5719-llvm-03b84e4f6d0e1c04f22d69cc445f36e1f713beb4.tar.gz bcm5719-llvm-03b84e4f6d0e1c04f22d69cc445f36e1f713beb4.zip |
[clang] Report sanitizer blacklist as a dependency in cc1
Previously these were reported from the driver which blocked clang-scan-deps from getting the full set of dependencies from cc1 commands.
Also the default sanitizer blacklist that is added in driver was never reported as a dependency. I introduced -fsanitize-system-blacklist cc1 option to keep track of which blacklists were user-specified and which were added by driver and clang -MD now also reports system blacklists as dependencies.
Differential Revision: https://reviews.llvm.org/D69290
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 195a29d7118..17fd4ce7752 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1447,7 +1447,26 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, // Add sanitizer blacklists as extra dependencies. // They won't be discovered by the regular preprocessor, so // we let make / ninja to know about this implicit dependency. - Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry); + if (!Args.hasArg(OPT_fno_sanitize_blacklist)) { + for (const auto *A : Args.filtered(OPT_fsanitize_blacklist)) { + StringRef Val = A->getValue(); + if (Val.find('=') == StringRef::npos) + Opts.ExtraDeps.push_back(Val); + } + if (Opts.IncludeSystemHeaders) { + for (const auto *A : Args.filtered(OPT_fsanitize_system_blacklist)) { + StringRef Val = A->getValue(); + if (Val.find('=') == StringRef::npos) + Opts.ExtraDeps.push_back(Val); + } + } + } + + // Propagate the extra dependencies. + for (const auto *A : Args.filtered(OPT_fdepfile_entry)) { + Opts.ExtraDeps.push_back(A->getValue()); + } + // Only the -fmodule-file=<file> form. for (const auto *A : Args.filtered(OPT_fmodule_file)) { StringRef Val = A->getValue(); |