[clang] [llvm] [clang][ScanDeps] Allow PCHs to have different VFS overlays (PR #82294)

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 13:20:03 PST 2024


================
@@ -175,8 +192,19 @@ 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 emit warnings except for scanning specific warnings.
+  // TODO: It would be useful to add a more principled way to ignore all
+  //       warnings that come from source code. The issue is that we need to
+  //       ignore warnings that could be surpressed by
+  //       `#pragma clang diagnostic`, while still allowing some scanning
+  //       warnings for things we're not ready to turn into errors yet.
----------------
Bigcheese wrote:

The scanner never sees `#pragma clang diagnostic`, so there's no issue with code that uses that to turn warnings on. The original issue was with warnings getting turned off via `#pragma clang diagnostic`, but the new code removes all warnings and `Werror`s, so you're just left with default warnings.

The goal here was to keep driver warnings (which are lost otherwise) and allow us to have dedicated scanner warnings. I do think we want more control over this, possibly add a scanner bit to diagnostics so we can be explicit about which warnings we expect from the scanner, but I think this change is fine for now.

https://github.com/llvm/llvm-project/pull/82294


More information about the llvm-commits mailing list