[clang] 2f8ac18 - Revert "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."

Douglas Yung via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 21:24:02 PST 2022


Author: Douglas Yung
Date: 2022-11-28T21:22:29-08:00
New Revision: 2f8ac1804827026b44f429dce02730da18a73c50

URL: https://github.com/llvm/llvm-project/commit/2f8ac1804827026b44f429dce02730da18a73c50
DIFF: https://github.com/llvm/llvm-project/commit/2f8ac1804827026b44f429dce02730da18a73c50.diff

LOG: Revert "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."

This reverts commit eac90d1236cfd2935fac5cbe5634f09e2cd0981a.

This change is causing a test failure on the PS4/PS5 bots:
https://lab.llvm.org/buildbot/#/builders/139/builds/31784
https://lab.llvm.org/buildbot/#/builders/216/builds/13476

Added: 
    

Modified: 
    clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Removed: 
    clang/test/ClangScanDeps/diagnostic-pragmas.c


################################################################################
diff  --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index ff2d4b76820ed..50c42087d2fa2 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -135,8 +135,8 @@ static void sanitizeDiagOpts(DiagnosticOptions &DiagOpts) {
   DiagOpts.ShowCarets = false;
   // Don't write out diagnostic file.
   DiagOpts.DiagnosticSerializationFile.clear();
-  // Don't emit warnings as errors (and all other warnings too).
-  DiagOpts.IgnoreWarnings = true;
+  // Don't treat warnings as errors.
+  DiagOpts.Warnings.push_back("no-error");
 }
 
 /// A clang tool that runs the preprocessor in a mode that's optimized for

diff  --git a/clang/test/ClangScanDeps/diagnostic-pragmas.c b/clang/test/ClangScanDeps/diagnostic-pragmas.c
deleted file mode 100644
index 520f82047d2b1..0000000000000
--- a/clang/test/ClangScanDeps/diagnostic-pragmas.c
+++ /dev/null
@@ -1,35 +0,0 @@
-// Test scanning deps does not have more errors than the regular compilation.
-
-// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
-
-// Check the regular compilation does not fail.
-// RUN: %clang -fsyntax-only %t/test.c -I %t/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -Wnon-modular-include-in-module -Werror=non-modular-include-in-module
-
-// And now scanning deps should succeed too.
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1
-
-//--- cdb.json.template
-[
-  {
-    "directory": "DIR",
-    "command": "clang -fsyntax-only DIR/test.c -I DIR/include -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -Wnon-modular-include-in-module -Werror=non-modular-include-in-module",
-    "file": "DIR/test.c"
-  },
-]
-
-//--- include/nonmodular.h
-// empty
-
-//--- include/modular-includer.h
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wnon-modular-include-in-module"
-#include <nonmodular.h>
-#pragma clang diagnostic pop
-
-//--- include/module.modulemap
-module ModularIncluder { header "modular-includer.h" }
-
-//--- test.c
-#include <modular-includer.h>


        


More information about the cfe-commits mailing list