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 {
1074
1074
// / resets the error state to "success".
1075
1075
DiagnosedSilenceableFailure checkAndResetError ();
1076
1076
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.
1078
1079
std::string getLatestMatchFailureMessage ();
1079
1080
1080
1081
// / Return "true" if this tracking listener had a failure.
1081
1082
bool failed () const ;
1082
1083
1083
1084
protected:
1084
-
1085
1085
void
1086
1086
notifyMatchFailure (Location loc,
1087
- function_ref<void (Diagnostic &)> reasonCallback) override ;
1087
+ function_ref<void (Diagnostic &)> reasonCallback) override ;
1088
1088
1089
1089
void
1090
1090
notifyPayloadReplacementNotFound (Operation *op, ValueRange values,
@@ -1099,7 +1099,7 @@ class ErrorCheckingTrackingListener : public TrackingListener {
1099
1099
int64_t errorCounter = 0 ;
1100
1100
1101
1101
// / Latest message from match failure notification.
1102
- std::string matchFailureMsg = " " ;
1102
+ std::optional<Diagnostic> matchFailure ;
1103
1103
};
1104
1104
1105
1105
// / 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(
1390
1390
++errorCounter;
1391
1391
}
1392
1392
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 ();
1395
1399
}
1396
1400
1397
1401
void transform::ErrorCheckingTrackingListener::notifyMatchFailure (
1398
- Location loc, function_ref<void (Diagnostic &)> reasonCallback) {
1402
+ Location loc, function_ref<void (Diagnostic &)> reasonCallback) {
1399
1403
Diagnostic diag (loc, DiagnosticSeverity::Remark);
1400
1404
reasonCallback (diag);
1401
- matchFailureMsg = diag. str ( );
1405
+ matchFailure = std::move (diag );
1402
1406
}
1403
1407
1404
1408
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments