@@ -340,35 +340,41 @@ bool TestConstMemorySpaceAttr::isValidLoad(
340340bool 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
346348bool 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
352356bool 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
359365bool 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
366372bool 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