Skip to content

[TableGen] Migrate away from PointerUnion::{is,get} (NFC) #122569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/TableGen/Operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ unsigned Operator::getNumVariableLengthOperands() const {
}

bool Operator::hasSingleVariadicArg() const {
return getNumArgs() == 1 && getArg(0).is<NamedTypeConstraint *>() &&
return getNumArgs() == 1 && isa<NamedTypeConstraint *>(getArg(0)) &&
getOperand(0).isVariadic();
}

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

Expand Down
7 changes: 3 additions & 4 deletions mlir/lib/TableGen/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ std::string SymbolInfoMap::SymbolInfo::getVarTypeStr(StringRef name) const {
switch (kind) {
case Kind::Attr: {
if (op)
return op->getArg(getArgIndex())
.get<NamedAttribute *>()
return cast<NamedAttribute *>(op->getArg(getArgIndex()))
->attr.getStorageType()
.str();
// TODO(suderman): Use a more exact type when available.
Expand Down Expand Up @@ -305,7 +304,7 @@ std::string SymbolInfoMap::SymbolInfo::getValueAndRangeUse(
}
case Kind::Operand: {
assert(index < 0);
auto *operand = op->getArg(getArgIndex()).get<NamedTypeConstraint *>();
auto *operand = cast<NamedTypeConstraint *>(op->getArg(getArgIndex()));
// If this operand is variadic and this SymbolInfo doesn't have a range
// index, then return the full variadic operand_range. Otherwise, return
// the value itself.
Expand Down Expand Up @@ -447,7 +446,7 @@ bool SymbolInfoMap::bindOpArgument(DagNode node, StringRef symbol,
}

auto symInfo =
op.getArg(argIndex).is<NamedAttribute *>()
isa<NamedAttribute *>(op.getArg(argIndex))
? SymbolInfo::getAttr(&op, argIndex)
: SymbolInfo::getOperand(node, &op, argIndex, variadicSubIndex);

Expand Down
Loading