}
}
+/// isSubprogramContext - Return true if Context is either a subprogram
+/// or another context nested inside a subprogram.
+bool DwarfDebug::isSubprogramContext(const MDNode *Context) {
+ if (!Context)
+ return false;
+ DIDescriptor D(Context);
+ if (D.isSubprogram())
+ return true;
+ if (D.isType())
+ return isSubprogramContext(resolve(DIType(Context).getContext()));
+ return false;
+}
+
// Find DIE for the given subprogram and attach appropriate DW_AT_low_pc
// and DW_AT_high_pc attributes. If there are global variables in this
// scope then create and insert DIEs for these variables.
// Add to context owner.
TheCU->addToContextOwner(SubprogramDie, SP.getContext());
- // Expose as global, if requested.
- if (HasDwarfPubSections)
- TheCU->addGlobalName(SP.getName(), SubprogramDie);
+ // Expose as a global name.
+ TheCU->addGlobalName(SP.getName(), SubprogramDie);
}
void DwarfDebug::constructImportedEntityDIE(CompileUnit *TheCU,
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
if (!CU_Nodes)
return;
+ TypeIdentifierMap = generateDITypeIdentifierMap(CU_Nodes);
// Emit initial sections so we can reference labels later.
emitSectionLabels();
// Emit the pubnames and pubtypes sections if requested.
if (HasDwarfPubSections) {
- emitDebugPubnames();
+ emitDebugPubNames();
emitDebugPubTypes();
}
AT.Emit(Asm, SectionBegin, &InfoHolder);
}
-/// emitDebugPubnames - Emit visible names into a debug pubnames section.
+/// emitDebugPubNames - Emit visible names into a debug pubnames section.
///
-void DwarfDebug::emitDebugPubnames() {
+void DwarfDebug::emitDebugPubNames() {
const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
typedef DenseMap<const MDNode*, CompileUnit*> CUMapType;