[clang] [llvm] [CUDA/HIP][SYCL] Deduplicate deferred diagnostics across multiple callers (PR #185926)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 18:05:31 PDT 2026


================
@@ -2020,13 +2037,14 @@ class DeferredDiagnosticsEmitter
         DiagnosticBuilder Builder(S.Diags.Report(Loc, PD.getDiagID()));
         PD.Emit(Builder);
       }
-      // Emit the note on the first diagnostic in case too many diagnostics
-      // cause the note not emitted.
-      if (FirstDiag && HasWarningOrError && ShowCallStack) {
-        emitCallStackNotes(S, FD);
-        FirstDiag = false;
-      }
     }
+    if (HasWarningOrError)
+      emitCallStackNotes(S, FD);
+  }
+
+  void emitCollectedDiags() {
+    for (const auto &FD : FnsToEmit)
----------------
Artem-B wrote:

Does `FnsToEmit` guarantee stable iteration order? We probably want diags to be repeatable from run to run.

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


More information about the cfe-commits mailing list