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

Reply via email to