mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
Emit DW_AT_object_pointer once, on the declaration, for each function.
This effectively reverts r164326, but adds some comments and justification and ensures we /don't/ emit the DW_AT_object_pointer on the (abstract and concrete) definitions. (while still preserving it on standalone definitions involving ObjC Blocks) This does increase the size of member function declarations from 7 to 11 bytes, unfortunately, but still seems like the Right Thing to do so that callers that see only the declaration still have the information about the object pointer. That said, I don't know what, if any, DWARF consumers don't have a heuristic to guess this in the case of normal C++ member functions - perhaps we can remove it entirely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -548,11 +548,16 @@ DIE *DwarfDebug::createScopeChildrenDIE(
|
||||
}
|
||||
|
||||
void DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
|
||||
LexicalScope *Scope, DIE &ScopeDIE) {
|
||||
LexicalScope *Scope,
|
||||
DISubprogram Sub, DIE &ScopeDIE) {
|
||||
// We create children when the scope DIE is not null.
|
||||
SmallVector<std::unique_ptr<DIE>, 8> Children;
|
||||
if (DIE *ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children))
|
||||
TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
|
||||
// The declaration will have the object_pointer, otherwise put it on the
|
||||
// definition. This happens with ObjC blocks that have object_pointer on
|
||||
// non-member functions.
|
||||
if (!Sub.getFunctionDeclaration())
|
||||
TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
|
||||
|
||||
// Add children
|
||||
for (auto &I : Children)
|
||||
@ -571,7 +576,7 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
|
||||
|
||||
if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
|
||||
AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
|
||||
createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
|
||||
createAndAddScopeChildren(TheCU, Scope, Sub, *ScopeDIE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,7 +593,7 @@ DIE &DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
|
||||
|
||||
DIE &ScopeDIE = updateSubprogramScopeDIE(TheCU, Sub);
|
||||
|
||||
createAndAddScopeChildren(TheCU, Scope, ScopeDIE);
|
||||
createAndAddScopeChildren(TheCU, Scope, Sub, ScopeDIE);
|
||||
|
||||
return ScopeDIE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user