[Mlir-commits] [mlir] 3ce9a5b - [Support][mlir] Clean up list of unmatched @unknown directives (#236282)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 28 21:51:23 PDT 2026
Author: Alexander Richardson
Date: 2026-10-28T21:51:19-07:00
New Revision: 3ce9a5bc9128cdb794a4a76f37ce8bf2fc13a1d4
URL: https://github.com/llvm/llvm-project/commit/3ce9a5bc9128cdb794a4a76f37ce8bf2fc13a1d4
DIFF: https://github.com/llvm/llvm-project/commit/3ce9a5bc9128cdb794a4a76f37ce8bf2fc13a1d4.diff
LOG: [Support][mlir] Clean up list of unmatched @unknown directives (#236282)
mlir-opt calls `verify()` twice (explicitly and in the handler's
destructor), and `verify()` clears the per-file directive lists, but
did not clear the list of `@unknown` ones.
This fixes reporting unmatched `@unknown` twice.
Assisted-by: AI tooling
Pull-Request: https://github.com/llvm/llvm-project/pull/236282
Added:
Modified:
llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp
mlir/test/mlir-opt/expected-unknown-loc-unmatched.mlir
Removed:
################################################################################
diff --git a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp
index 1c5c541d7be4ac..9d9cf2d398c933 100644
--- a/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp
+++ b/llvm/lib/Support/SourceMgrDiagnosticVerifier.cpp
@@ -269,5 +269,6 @@ bool SourceMgrDiagnosticVerifier::verify(raw_ostream &os, SourceMgr &mgr) {
for (auto &diag : expectedUnknownLocDiags)
checkExpectedDiags(diag);
expectedDiagsPerFile.clear();
+ expectedUnknownLocDiags.clear();
return ok;
}
diff --git a/mlir/test/mlir-opt/expected-unknown-loc-unmatched.mlir b/mlir/test/mlir-opt/expected-unknown-loc-unmatched.mlir
index 5a06d386dabf87..c97825c4599483 100644
--- a/mlir/test/mlir-opt/expected-unknown-loc-unmatched.mlir
+++ b/mlir/test/mlir-opt/expected-unknown-loc-unmatched.mlir
@@ -1,9 +1,11 @@
// Test that an unmatched `expected-*` directive using the `@unknown` location
-// specifier emits a diagnostic instead of crashing.
+// specifier emits a diagnostic instead of crashing, and only once even though
+// mlir-opt verifies twice (explicitly and in the handler's destructor).
// See https://github.com/llvm/llvm-project/issues/163343
-// RUN: not mlir-opt --verify-diagnostics %s 2>&1 | FileCheck %s
+// RUN: not mlir-opt --verify-diagnostics %s 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not=error:
-// CHECK: expected warning "some warning that is never produced" was not produced
+// CHECK: error: expected warning "some warning that is never produced" was not produced
// expected-warning @unknown {{some warning that is never produced}}
More information about the Mlir-commits
mailing list