Skip to content

Commit 6cd11af

Browse files
committed
address reviewer comments
1 parent 994c9d7 commit 6cd11af

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

mlir/test/lib/Dialect/Test/TestAttributes.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,35 +340,41 @@ bool TestConstMemorySpaceAttr::isValidLoad(
340340
bool TestConstMemorySpaceAttr::isValidStore(
341341
Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
342342
function_ref<InFlightDiagnostic()> emitError) const {
343-
return emitError ? failed(emitError() << "memory space is read-only") : false;
343+
if (emitError)
344+
emitError() << "memory space is read-only";
345+
return false;
344346
}
345347

346348
bool TestConstMemorySpaceAttr::isValidAtomicOp(
347349
mlir::ptr::AtomicBinOp binOp, Type type, mlir::ptr::AtomicOrdering ordering,
348350
IntegerAttr alignment, function_ref<InFlightDiagnostic()> emitError) const {
349-
return emitError ? failed(emitError() << "memory space is read-only") : false;
351+
if (emitError)
352+
emitError() << "memory space is read-only";
353+
return false;
350354
}
351355

352356
bool TestConstMemorySpaceAttr::isValidAtomicXchg(
353357
Type type, mlir::ptr::AtomicOrdering successOrdering,
354358
mlir::ptr::AtomicOrdering failureOrdering, IntegerAttr alignment,
355359
function_ref<InFlightDiagnostic()> emitError) const {
356-
return emitError ? failed(emitError() << "memory space is read-only") : false;
360+
if (emitError)
361+
emitError() << "memory space is read-only";
362+
return false;
357363
}
358364

359365
bool TestConstMemorySpaceAttr::isValidAddrSpaceCast(
360366
Type tgt, Type src, function_ref<InFlightDiagnostic()> emitError) const {
361-
return emitError ? failed(emitError()
362-
<< "memory space doesn't allow addrspace casts")
363-
: false;
367+
if (emitError)
368+
emitError() << "memory space doesn't allow addrspace casts";
369+
return false;
364370
}
365371

366372
bool TestConstMemorySpaceAttr::isValidPtrIntCast(
367373
Type intLikeTy, Type ptrLikeTy,
368374
function_ref<InFlightDiagnostic()> emitError) const {
369-
return emitError
370-
? failed(emitError() << "memory space doesn't allow int-ptr casts")
371-
: false;
375+
if (emitError)
376+
emitError() << "memory space doesn't allow int-ptr casts";
377+
return false;
372378
}
373379

374380
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)