[clang] [clang][DependencyScanner] Remove all warning flags when suppressing warnings (PR #71612)

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 16:30:25 PST 2023


================
@@ -52,6 +52,28 @@ static void optimizeHeaderSearchOpts(HeaderSearchOptions &Opts,
     Opts.UserEntries.push_back(Entries[Idx]);
 }
 
+static void optimizeDiagnosticOpts(DiagnosticOptions &Opts,
+                                   bool IsSystemModule) {
+  // If this is not a system module or -Wsystem-headers was passed, don't
+  // optimize.
+  if (!IsSystemModule)
+    return;
+  bool Wsystem_headers = false;
+  for (StringRef Opt : Opts.Warnings) {
+    bool isPositive = !Opt.consume_front("no-");
+    if (Opt == "system-headers")
+      Wsystem_headers = isPositive;
+  }
+  if (Wsystem_headers)
+    return;
----------------
Bigcheese wrote:

I don't really see a good way to reuse that, it's doing a bunch of other work on the `DiagnosticsEngine`, and the loop itself wants to process `no-` once and then check a bunch of different warning flags.

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


More information about the cfe-commits mailing list