aboutsummaryrefslogtreecommitdiff
path: root/mlir/include
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2022-11-02 15:22:43 +0000
committerAlex Zinenko <zinenko@google.com>2022-12-12 12:52:06 +0000
commit7d5bef77e560f172ebd13471eb24c4cb6063b568 (patch)
treec6f378ac1f75aaec2b15a2479c55ec67062494a9 /mlir/include
parent843be73065617a4b55a542aff7d0b286c1e9b888 (diff)
downloadllvm-7d5bef77e560f172ebd13471eb24c4cb6063b568.zip
llvm-7d5bef77e560f172ebd13471eb24c4cb6063b568.tar.gz
llvm-7d5bef77e560f172ebd13471eb24c4cb6063b568.tar.bz2
[mlir] make DiagnosedSilenceableError(LogicalResult) ctor private
Now we have more convenient functions to construct silenceable errors while emitting diagnostics, and the constructor is ambiguous as it doesn't tell whether the logical error is silencebale or definite. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D137257
Diffstat (limited to 'mlir/include')
-rw-r--r--mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h2
-rw-r--r--mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td24
2 files changed, 13 insertions, 13 deletions
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
index bbcfabe..99e12a1 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
@@ -34,7 +34,6 @@ namespace mlir {
/// failures as their diagnostics have been already reported to the user.
class [[nodiscard]] DiagnosedSilenceableFailure {
public:
- explicit DiagnosedSilenceableFailure(LogicalResult result) : result(result) {}
DiagnosedSilenceableFailure(const DiagnosedSilenceableFailure &) = delete;
DiagnosedSilenceableFailure &
operator=(const DiagnosedSilenceableFailure &) = delete;
@@ -156,6 +155,7 @@ public:
}
private:
+ explicit DiagnosedSilenceableFailure(LogicalResult result) : result(result) {}
explicit DiagnosedSilenceableFailure(Diagnostic &&diagnostic)
: result(failure()) {
diagnostics.emplace_back(std::move(diagnostic));
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
index fe29f30..3378153 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.td
@@ -51,23 +51,12 @@ def TransformOpInterface : OpInterface<"TransformOpInterface"> {
];
let extraSharedClassDeclaration = [{
- /// Emits a generic transform error for the current transform operation
- /// targeting the given Payload IR operation and returns failure. Should
- /// be only used as a last resort when the transformation itself provides
- /// no further indication as to the reason of the failure.
- ::mlir::LogicalResult reportUnknownTransformError(
- ::mlir::Operation *target) {
- ::mlir::InFlightDiagnostic diag = $_op->emitError() << "failed to apply";
- diag.attachNote(target->getLoc()) << "attempted to apply to this op";
- return diag;
- }
-
/// Creates the silenceable failure object with a diagnostic located at the
/// current operation. Silenceable failure must be suppressed or reported
/// explicitly at some later time.
DiagnosedSilenceableFailure
emitSilenceableError(const ::llvm::Twine &message = {}) {
- return ::mlir::emitSilenceableFailure($_op);
+ return ::mlir::emitSilenceableFailure($_op, message);
}
/// Creates the definite failure object with a diagnostic located at the
@@ -78,6 +67,17 @@ def TransformOpInterface : OpInterface<"TransformOpInterface"> {
return ::mlir::emitDefiniteFailure($_op, message);
}
+ /// Emits a generic definite failure for the current transform operation
+ /// targeting the given Payload IR operation and returns failure. Should
+ /// be only used as a last resort when the transformation itself provides
+ /// no further indication as to the reason of the failure.
+ DiagnosedDefiniteFailure emitDefaultDefiniteFailure(
+ ::mlir::Operation *target) {
+ auto diag = ::mlir::emitDefiniteFailure($_op, "failed to apply");
+ diag.attachNote(target->getLoc()) << "attempted to apply to this op";
+ return diag;
+ }
+
/// Creates the default silenceable failure for a transform op that failed
/// to properly apply to a target.
DiagnosedSilenceableFailure emitDefaultSilenceableFailure(