[clang][deps] Move injection of `-Wno-error` from `clang-scan-deps` to `DependencySca...
authorJan Svoboda <jan_svoboda@apple.com>
Mon, 14 Jun 2021 10:09:54 +0000 (12:09 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Mon, 14 Jun 2021 10:23:33 +0000 (12:23 +0200)
This moves another piece of logic specific to `clang-scan-deps` into the `DependencyScanning` library. This makes it easier to check how the original command-line looked like in the library and will enable the library to stop inventing `-Wno-error` for modular dependencies (see D104036).

Reviewed By: arphaman

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

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
clang/tools/clang-scan-deps/ClangScanDeps.cpp

index e9392ee..0011a56 100644 (file)
@@ -107,6 +107,8 @@ public:
     Compiler.getDiagnosticOpts().ShowCarets = false;
     // Don't write out diagnostic file.
     Compiler.getDiagnosticOpts().DiagnosticSerializationFile.clear();
+    // Don't treat warnings as errors.
+    Compiler.getDiagnosticOpts().Warnings.push_back("no-error");
     // Create the compiler's actual diagnostics engine.
     Compiler.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
     if (!Compiler.hasDiagnostics())
index d9f1b58..8a15750 100644 (file)
@@ -504,7 +504,6 @@ int main(int argc, const char **argv) {
         }
         AdjustedArgs.push_back("-Xclang");
         AdjustedArgs.push_back("-sys-header-deps");
-        AdjustedArgs.push_back("-Wno-error");
 
         if (!HasResourceDir) {
           StringRef ResourceDir =