diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 2723b1f55ccaa..bf166cbb043de 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1481,16 +1481,16 @@ void DwarfUnit::constructSubrangeDIE(DIE &DW_Subrange, const DISubrangeType *SR, auto AddBoundTypeEntry = [&](dwarf::Attribute Attr, DISubrangeType::BoundType Bound) -> void { - if (auto *BV = Bound.dyn_cast()) { + if (auto *BV = dyn_cast_if_present(Bound)) { if (auto *VarDIE = getDIE(BV)) addDIEEntry(DW_Subrange, Attr, *VarDIE); - } else if (auto *BE = Bound.dyn_cast()) { + } else if (auto *BE = dyn_cast_if_present(Bound)) { DIELoc *Loc = new (DIEValueAllocator) DIELoc; DIEDwarfExpression DwarfExpr(*Asm, getCU(), *Loc); DwarfExpr.setMemoryLocationKind(); DwarfExpr.addExpression(BE); addBlock(DW_Subrange, Attr, DwarfExpr.finalize()); - } else if (auto *BI = Bound.dyn_cast()) { + } else if (auto *BI = dyn_cast_if_present(Bound)) { if (Attr == dwarf::DW_AT_GNU_bias) { if (BI->getSExtValue() != 0) addUInt(DW_Subrange, Attr, dwarf::DW_FORM_sdata, BI->getSExtValue());