Skip to content

Commit 96e3876

Browse files
[AsmPrinter] Migrate away from PointerUnion::dyn_cast (NFC) (#135740)
Note that PointerUnion::dyn_cast has 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> We use dyn_cast_if_present here because Bound can be null.
1 parent e65faed commit 96e3876

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,16 +1481,16 @@ void DwarfUnit::constructSubrangeDIE(DIE &DW_Subrange, const DISubrangeType *SR,
14811481

14821482
auto AddBoundTypeEntry = [&](dwarf::Attribute Attr,
14831483
DISubrangeType::BoundType Bound) -> void {
1484-
if (auto *BV = Bound.dyn_cast<DIVariable *>()) {
1484+
if (auto *BV = dyn_cast_if_present<DIVariable *>(Bound)) {
14851485
if (auto *VarDIE = getDIE(BV))
14861486
addDIEEntry(DW_Subrange, Attr, *VarDIE);
1487-
} else if (auto *BE = Bound.dyn_cast<DIExpression *>()) {
1487+
} else if (auto *BE = dyn_cast_if_present<DIExpression *>(Bound)) {
14881488
DIELoc *Loc = new (DIEValueAllocator) DIELoc;
14891489
DIEDwarfExpression DwarfExpr(*Asm, getCU(), *Loc);
14901490
DwarfExpr.setMemoryLocationKind();
14911491
DwarfExpr.addExpression(BE);
14921492
addBlock(DW_Subrange, Attr, DwarfExpr.finalize());
1493-
} else if (auto *BI = Bound.dyn_cast<ConstantInt *>()) {
1493+
} else if (auto *BI = dyn_cast_if_present<ConstantInt *>(Bound)) {
14941494
if (Attr == dwarf::DW_AT_GNU_bias) {
14951495
if (BI->getSExtValue() != 0)
14961496
addUInt(DW_Subrange, Attr, dwarf::DW_FORM_sdata, BI->getSExtValue());

0 commit comments

Comments
 (0)