Skip to content

Commit a1bbb0c

Browse files
committed
(Partial backport) Switch member calls to isa/dyn_cast/cast/... to free function calls. (llvm#89356)
This change cleans up call sites. Next step is to mark the member functions deprecated. See https://mlir.llvm.org/deprecation and https://discourse.llvm.org/t/preferred-casting-style-going-forward.
1 parent 5077647 commit a1bbb0c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ LogicalResult AddOp::verify() {
160160
Type lhsType = getLhs().getType();
161161
Type rhsType = getRhs().getType();
162162

163-
if (lhsType.isa<emitc::PointerType>() && rhsType.isa<emitc::PointerType>())
163+
if (isa<emitc::PointerType>(lhsType) && isa<emitc::PointerType>(rhsType))
164164
return emitOpError("requires that at most one operand is a pointer");
165165

166-
if ((lhsType.isa<emitc::PointerType>() &&
167-
!rhsType.isa<IntegerType, emitc::OpaqueType>()) ||
168-
(rhsType.isa<emitc::PointerType>() &&
169-
!lhsType.isa<IntegerType, emitc::OpaqueType>()))
166+
if ((isa<emitc::PointerType>(lhsType) &&
167+
!isa<IntegerType, emitc::OpaqueType>(rhsType)) ||
168+
(isa<emitc::PointerType>(rhsType) &&
169+
!isa<IntegerType, emitc::OpaqueType>(lhsType)))
170170
return emitOpError("requires that one operand is an integer or of opaque "
171171
"type if the other is a pointer");
172172

@@ -778,16 +778,16 @@ LogicalResult SubOp::verify() {
778778
Type rhsType = getRhs().getType();
779779
Type resultType = getResult().getType();
780780

781-
if (rhsType.isa<emitc::PointerType>() && !lhsType.isa<emitc::PointerType>())
781+
if (isa<emitc::PointerType>(rhsType) && !isa<emitc::PointerType>(lhsType))
782782
return emitOpError("rhs can only be a pointer if lhs is a pointer");
783783

784-
if (lhsType.isa<emitc::PointerType>() &&
785-
!rhsType.isa<IntegerType, emitc::OpaqueType, emitc::PointerType>())
784+
if (isa<emitc::PointerType>(lhsType) &&
785+
!isa<IntegerType, emitc::OpaqueType, emitc::PointerType>(rhsType))
786786
return emitOpError("requires that rhs is an integer, pointer or of opaque "
787787
"type if lhs is a pointer");
788788

789-
if (lhsType.isa<emitc::PointerType>() && rhsType.isa<emitc::PointerType>() &&
790-
!resultType.isa<IntegerType, emitc::OpaqueType>())
789+
if (isa<emitc::PointerType>(lhsType) && isa<emitc::PointerType>(rhsType) &&
790+
!isa<IntegerType, emitc::OpaqueType>(resultType))
791791
return emitOpError("requires that the result is an integer or of opaque "
792792
"type if lhs and rhs are pointers");
793793
return success();

0 commit comments

Comments
 (0)