[flang-commits] [flang] [flang] remove sequences of duplicate messages (PR #161916)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Oct 3 15:04:53 PDT 2025


================
@@ -477,15 +477,31 @@ void Messages::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
   }
   std::stable_sort(sorted.begin(), sorted.end(),
       [](const Message *x, const Message *y) { return x->SortBefore(*y); });
-  const Message *lastMsg{nullptr};
+  std::vector<const Message *> msgsWithLastLocation;
   std::size_t errorsEmitted{0};
   for (const Message *msg : sorted) {
-    if (lastMsg && *msg == *lastMsg) {
-      // Don't emit two identical messages for the same location
+    bool shouldSkipMsg = false;
----------------
klausler wrote:

Please always use braced initialization outside lowering.

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


More information about the flang-commits mailing list