[Mlir-commits] [mlir] [mlir][ptr] Switch `LogicalResult` to `bool` in `MemorySpaceAttrInterrface` (PR #137513)
Mehdi Amini
llvmlistbot at llvm.org
Sun Apr 27 06:19:05 PDT 2025
================
@@ -331,43 +331,44 @@ TestOpAsmAttrInterfaceAttr::getAlias(::llvm::raw_ostream &os) const {
// TestConstMemorySpaceAttr
//===----------------------------------------------------------------------===//
-LogicalResult TestConstMemorySpaceAttr::isValidLoad(
+bool TestConstMemorySpaceAttr::isValidLoad(
Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
function_ref<InFlightDiagnostic()> emitError) const {
- return success();
+ return true;
}
-LogicalResult TestConstMemorySpaceAttr::isValidStore(
+bool TestConstMemorySpaceAttr::isValidStore(
Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
function_ref<InFlightDiagnostic()> emitError) const {
- return emitError ? (emitError() << "memory space is read-only") : failure();
+ return emitError ? failed(emitError() << "memory space is read-only") : false;
}
-LogicalResult TestConstMemorySpaceAttr::isValidAtomicOp(
+bool TestConstMemorySpaceAttr::isValidAtomicOp(
mlir::ptr::AtomicBinOp binOp, Type type, mlir::ptr::AtomicOrdering ordering,
IntegerAttr alignment, function_ref<InFlightDiagnostic()> emitError) const {
- return emitError ? (emitError() << "memory space is read-only") : failure();
+ return emitError ? failed(emitError() << "memory space is read-only") : false;
}
-LogicalResult TestConstMemorySpaceAttr::isValidAtomicXchg(
+bool TestConstMemorySpaceAttr::isValidAtomicXchg(
Type type, mlir::ptr::AtomicOrdering successOrdering,
mlir::ptr::AtomicOrdering failureOrdering, IntegerAttr alignment,
function_ref<InFlightDiagnostic()> emitError) const {
- return emitError ? (emitError() << "memory space is read-only") : failure();
+ return emitError ? failed(emitError() << "memory space is read-only") : false;
}
-LogicalResult TestConstMemorySpaceAttr::isValidAddrSpaceCast(
+bool TestConstMemorySpaceAttr::isValidAddrSpaceCast(
Type tgt, Type src, function_ref<InFlightDiagnostic()> emitError) const {
- return emitError
- ? (emitError() << "memory space doesn't allow addrspace casts")
- : failure();
+ return emitError ? failed(emitError()
+ << "memory space doesn't allow addrspace casts")
+ : false;
}
-LogicalResult TestConstMemorySpaceAttr::isValidPtrIntCast(
+bool TestConstMemorySpaceAttr::isValidPtrIntCast(
Type intLikeTy, Type ptrLikeTy,
function_ref<InFlightDiagnostic()> emitError) const {
- return emitError ? (emitError() << "memory space doesn't allow int-ptr casts")
- : failure();
+ return emitError
+ ? failed(emitError() << "memory space doesn't allow int-ptr casts")
+ : false;
----------------
joker-eph wrote:
```suggestion
if (emitError) emitError() << "memory space doesn't allow int-ptr casts";
return false;
```
https://github.com/llvm/llvm-project/pull/137513
More information about the Mlir-commits
mailing list