Skip to content

Commit 26d513d

Browse files
[TableGen] Migrate away from PointerUnion::{is,get} (NFC) (llvm#122569)
Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T>
1 parent a3e62d8 commit 26d513d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

mlir/lib/TableGen/Operator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ unsigned Operator::getNumVariableLengthOperands() const {
231231
}
232232

233233
bool Operator::hasSingleVariadicArg() const {
234-
return getNumArgs() == 1 && getArg(0).is<NamedTypeConstraint *>() &&
234+
return getNumArgs() == 1 && isa<NamedTypeConstraint *>(getArg(0)) &&
235235
getOperand(0).isVariadic();
236236
}
237237

@@ -829,7 +829,7 @@ void Operator::print(llvm::raw_ostream &os) const {
829829
if (auto *attr = llvm::dyn_cast_if_present<NamedAttribute *>(arg))
830830
os << "[attribute] " << attr->name << '\n';
831831
else
832-
os << "[operand] " << arg.get<NamedTypeConstraint *>()->name << '\n';
832+
os << "[operand] " << cast<NamedTypeConstraint *>(arg)->name << '\n';
833833
}
834834
}
835835

mlir/lib/TableGen/Pattern.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ std::string SymbolInfoMap::SymbolInfo::getVarTypeStr(StringRef name) const {
254254
switch (kind) {
255255
case Kind::Attr: {
256256
if (op)
257-
return op->getArg(getArgIndex())
258-
.get<NamedAttribute *>()
257+
return cast<NamedAttribute *>(op->getArg(getArgIndex()))
259258
->attr.getStorageType()
260259
.str();
261260
// TODO(suderman): Use a more exact type when available.
@@ -305,7 +304,7 @@ std::string SymbolInfoMap::SymbolInfo::getValueAndRangeUse(
305304
}
306305
case Kind::Operand: {
307306
assert(index < 0);
308-
auto *operand = op->getArg(getArgIndex()).get<NamedTypeConstraint *>();
307+
auto *operand = cast<NamedTypeConstraint *>(op->getArg(getArgIndex()));
309308
// If this operand is variadic and this SymbolInfo doesn't have a range
310309
// index, then return the full variadic operand_range. Otherwise, return
311310
// the value itself.
@@ -447,7 +446,7 @@ bool SymbolInfoMap::bindOpArgument(DagNode node, StringRef symbol,
447446
}
448447

449448
auto symInfo =
450-
op.getArg(argIndex).is<NamedAttribute *>()
449+
isa<NamedAttribute *>(op.getArg(argIndex))
451450
? SymbolInfo::getAttr(&op, argIndex)
452451
: SymbolInfo::getOperand(node, &op, argIndex, variadicSubIndex);
453452

0 commit comments

Comments
 (0)