[llvm] r289697 - DebugInfo: Improve type safety and simplify some subprogram finalization code
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 11:38:39 PST 2016
Author: dblaikie
Date: Wed Dec 14 13:38:39 2016
New Revision: 289697
URL: http://llvm.org/viewvc/llvm-project?rev=289697&view=rev
Log:
DebugInfo: Improve type safety and simplify some subprogram finalization code
This probably ended up this way aften the subprogram<>function link
inversion and debug info metadata schema changes.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=289697&r1=289696&r2=289697&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Dec 14 13:38:39 2016
@@ -364,13 +364,13 @@ void DwarfDebug::constructAbstractSubpro
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);
});
@@ -535,13 +535,11 @@ void DwarfDebug::finishVariableDefinitio
}
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() {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=289697&r1=289696&r2=289697&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Dec 14 13:38:39 2016
@@ -216,7 +216,7 @@ class DwarfDebug : public DebugHandlerBa
/// 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;
@@ -553,7 +553,7 @@ public:
// FIXME: Sink these functions down into DwarfFile/Dwarf*Unit.
- SmallPtrSet<const MDNode *, 16> &getProcessedSPNodes() {
+ SmallPtrSet<const DISubprogram *, 16> &getProcessedSPNodes() {
return ProcessedSPNodes;
}
};
More information about the llvm-commits
mailing list