File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
include/mlir/Dialect/Transform/Interfaces
lib/Dialect/Transform/Interfaces Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1074,17 +1074,17 @@ class ErrorCheckingTrackingListener : public TrackingListener {
10741074 // / resets the error state to "success".
10751075 DiagnosedSilenceableFailure checkAndResetError ();
10761076
1077- // / Return the latest match notification message.
1077+ // / Return the latest match notification message. Returns an empty string
1078+ // / when no error message was captured.
10781079 std::string getLatestMatchFailureMessage ();
10791080
10801081 // / Return "true" if this tracking listener had a failure.
10811082 bool failed () const ;
10821083
10831084protected:
1084-
10851085 void
10861086 notifyMatchFailure (Location loc,
1087- function_ref<void (Diagnostic &)> reasonCallback) override ;
1087+ function_ref<void (Diagnostic &)> reasonCallback) override ;
10881088
10891089 void
10901090 notifyPayloadReplacementNotFound (Operation *op, ValueRange values,
@@ -1099,7 +1099,7 @@ class ErrorCheckingTrackingListener : public TrackingListener {
10991099 int64_t errorCounter = 0 ;
11001100
11011101 // / Latest message from match failure notification.
1102- std::string matchFailureMsg = " " ;
1102+ std::optional<Diagnostic> matchFailure ;
11031103};
11041104
11051105// / This is a special rewriter to be used in transform op implementations,
Original file line number Diff line number Diff line change @@ -1390,15 +1390,19 @@ void transform::ErrorCheckingTrackingListener::notifyPayloadReplacementNotFound(
13901390 ++errorCounter;
13911391}
13921392
1393- std::string transform::ErrorCheckingTrackingListener::getLatestMatchFailureMessage () {
1394- return matchFailureMsg;
1393+ std::string
1394+ transform::ErrorCheckingTrackingListener::getLatestMatchFailureMessage () {
1395+ if (!matchFailure) {
1396+ return " " ;
1397+ }
1398+ return matchFailure->str ();
13951399}
13961400
13971401void transform::ErrorCheckingTrackingListener::notifyMatchFailure (
1398- Location loc, function_ref<void (Diagnostic &)> reasonCallback) {
1402+ Location loc, function_ref<void (Diagnostic &)> reasonCallback) {
13991403 Diagnostic diag (loc, DiagnosticSeverity::Remark);
14001404 reasonCallback (diag);
1401- matchFailureMsg = diag. str ( );
1405+ matchFailure = std::move (diag );
14021406}
14031407
14041408// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments