mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
DebugInfo: Following up to r209677, refactor local variable emission to delay the choice between emitting the definition attributes or using DW_AT_abstract_definition
This doesn't fix the abstract variable handling yet, but it introduces a similar delay mechanism as was added for subprograms, causing DW_AT_location to be reordered to the beginning of the attribute list for local variables, and fixes all the test fallout for that. A subsequent commit will remove the abstract variable handling in DbgVariable and just do the abstract variable lookup at module end to ensure that abstract variables introduced after their concrete counterparts are appropriately referenced by the concrete variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210943 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1514,6 +1514,17 @@ void DwarfUnit::applySubprogramAttributes(DISubprogram SP, DIE &SPDie) {
|
||||
addFlag(SPDie, dwarf::DW_AT_explicit);
|
||||
}
|
||||
|
||||
void DwarfUnit::applyVariableAttributes(const DbgVariable &Var,
|
||||
DIE &VariableDie) {
|
||||
StringRef Name = Var.getName();
|
||||
if (!Name.empty())
|
||||
addString(VariableDie, dwarf::DW_AT_name, Name);
|
||||
addSourceLine(VariableDie, Var.getVariable());
|
||||
addType(VariableDie, Var.getType());
|
||||
if (Var.isArtificial())
|
||||
addFlag(VariableDie, dwarf::DW_AT_artificial);
|
||||
}
|
||||
|
||||
// Return const expression if value is a GEP to access merged global
|
||||
// constant. e.g.
|
||||
// i8* getelementptr ({ i8, i8, i8, i8 }* @_MergedGlobals, i32 0, i32 0)
|
||||
@ -1787,24 +1798,13 @@ std::unique_ptr<DIE> DwarfUnit::constructVariableDIE(DbgVariable &DV,
|
||||
|
||||
std::unique_ptr<DIE> DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
|
||||
bool Abstract) {
|
||||
StringRef Name = DV.getName();
|
||||
|
||||
// Define variable debug information entry.
|
||||
auto VariableDie = make_unique<DIE>(DV.getTag());
|
||||
DbgVariable *AbsVar = DV.getAbstractVariable();
|
||||
if (AbsVar && AbsVar->getDIE()) {
|
||||
addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, *AbsVar->getDIE());
|
||||
} else {
|
||||
if (!Name.empty())
|
||||
addString(*VariableDie, dwarf::DW_AT_name, Name);
|
||||
addSourceLine(*VariableDie, DV.getVariable());
|
||||
addType(*VariableDie, DV.getType());
|
||||
if (DV.isArtificial())
|
||||
addFlag(*VariableDie, dwarf::DW_AT_artificial);
|
||||
}
|
||||
|
||||
if (Abstract)
|
||||
if (Abstract) {
|
||||
applyVariableAttributes(DV, *VariableDie);
|
||||
return VariableDie;
|
||||
}
|
||||
|
||||
// Add variable address.
|
||||
|
||||
|
Reference in New Issue
Block a user