assert(Scope->isAbstractScope());
assert(!Scope->getInlinedAt());
- const MDNode *SP = Scope->getScopeNode();
+ auto *SP = cast<DISubprogram>(Scope->getScopeNode());
ProcessedSPNodes.insert(SP);
// Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
// was inlined from another compile unit.
- auto &CU = *CUMap.lookup(cast<DISubprogram>(SP)->getUnit());
+ auto &CU = *CUMap.lookup(SP->getUnit());
forBothCUs(CU, [&](DwarfCompileUnit &CU) {
CU.constructAbstractSubprogramScopeDIE(Scope);
});
}
void DwarfDebug::finishSubprogramDefinitions() {
- for (auto &F : MMI->getModule()->functions())
- if (auto *SP = F.getSubprogram())
- if (ProcessedSPNodes.count(SP) &&
- SP->getUnit()->getEmissionKind() != DICompileUnit::NoDebug)
- forBothCUs(*CUMap.lookup(SP->getUnit()), [&](DwarfCompileUnit &CU) {
- CU.finishSubprogramDefinition(SP);
- });
+ for (const DISubprogram *SP : ProcessedSPNodes)
+ if (SP->getUnit()->getEmissionKind() != DICompileUnit::NoDebug)
+ forBothCUs(*CUMap.lookup(SP->getUnit()), [&](DwarfCompileUnit &CU) {
+ CU.finishSubprogramDefinition(SP);
+ });
}
void DwarfDebug::finalizeModuleInfo() {
/// This is a collection of subprogram MDNodes that are processed to
/// create DIEs.
- SmallPtrSet<const MDNode *, 16> ProcessedSPNodes;
+ SmallPtrSet<const DISubprogram *, 16> ProcessedSPNodes;
/// If nonnull, stores the current machine function we're processing.
const MachineFunction *CurFn;
// FIXME: Sink these functions down into DwarfFile/Dwarf*Unit.
- SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() {
+ SmallPtrSet<const DISubprogram *, 16> &getProcessedSPNodes() {
return ProcessedSPNodes;
}
};