================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to