diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index c2ff899c04ab..d30f0ef7af34 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -543,7 +543,7 @@ void DwarfUnit::addAccess(DIE &Die, DINode::DIFlags Flags) { } DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) { - if (!Context || isa<DIFile>(Context)) + if (!Context || isa<DIFile>(Context) || isa<DICompileUnit>(Context)) return &getUnitDie(); if (auto *T = dyn_cast<DIType>(Context)) return getOrCreateTypeDIE(T); @@ -1223,7 +1223,7 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP, "decl has a linkage name and it is different"); if (DeclLinkageName.empty() && // Always emit it for abstract subprograms. - (DD->useAllLinkageNames() || DU->getAbstractSPDies().lookup(SP))) + (DD->useAllLinkageNames() || DU->getAbstractScopeDIEs().lookup(SP))) addLinkageName(SPDie, LinkageName); if (!DeclDie) @@ -1362,16 +1362,16 @@ void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, auto AddBoundTypeEntry = [&](dwarf::Attribute Attr, DISubrange::BoundType Bound) -> void { - if (auto *BV = Bound.dyn_cast<DIVariable *>()) { + if (auto *BV = dyn_cast_if_present<DIVariable *>(Bound)) { if (auto *VarDIE = getDIE(BV)) addDIEEntry(DW_Subrange, Attr, *VarDIE); - } else if (auto *BE = Bound.dyn_cast<DIExpression *>()) { + } else if (auto *BE = dyn_cast_if_present<DIExpression *>(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<ConstantInt *>()) { + } else if (auto *BI = dyn_cast_if_present<ConstantInt *>(Bound)) { if (Attr == dwarf::DW_AT_count) { if (BI->getSExtValue() != -1) addUInt(DW_Subrange, Attr, std::nullopt, BI->getSExtValue()); @@ -1401,10 +1401,10 @@ void DwarfUnit::constructGenericSubrangeDIE(DIE &Buffer, auto AddBoundTypeEntry = [&](dwarf::Attribute Attr, DIGenericSubrange::BoundType Bound) -> void { - if (auto *BV = Bound.dyn_cast<DIVariable *>()) { + if (auto *BV = dyn_cast_if_present<DIVariable *>(Bound)) { if (auto *VarDIE = getDIE(BV)) addDIEEntry(DwGenericSubrange, Attr, *VarDIE); - } else if (auto *BE = Bound.dyn_cast<DIExpression *>()) { + } else if (auto *BE = dyn_cast_if_present<DIExpression *>(Bound)) { if (BE->isConstant() && DIExpression::SignedOrUnsignedConstant::SignedConstant == *BE->isConstant()) { @@ -1463,7 +1463,7 @@ static bool hasVectorBeenPadded(const DICompositeType *CTy) { const auto Subrange = cast<DISubrange>(Elements[0]); const auto NumVecElements = Subrange->getCount() - ? Subrange->getCount().get<ConstantInt *>()->getSExtValue() + ? cast<ConstantInt *>(Subrange->getCount())->getSExtValue() : 0; // Ensure we found the element count and that the actual size is wide |
