summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-11-11 01:55:22 +0000
committerStephen Hines <srhines@google.com>2011-11-14 09:12:12 -0800
commit4fffbb4e26c7ee764a853e54ba11aa57087b6ab1 (patch)
tree262f81f3064c716bafc304797a81a626e8eb612e
parente8c7497540eadce39596f7a0a354760831ab2a3d (diff)
downloadexternal_llvm-4fffbb4e26c7ee764a853e54ba11aa57087b6ab1.zip
external_llvm-4fffbb4e26c7ee764a853e54ba11aa57087b6ab1.tar.gz
external_llvm-4fffbb4e26c7ee764a853e54ba11aa57087b6ab1.tar.bz2
If we have a DIE with an AT_specification use that instead of the normal
addr DIE when adding to the dwarf accelerator tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144354 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 657763a..1e51709 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1095,6 +1095,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
addToContextOwner(VariableDIE, GVContext);
// Add location.
bool addToAccelTable = false;
+ DIE *VariableSpecDIE;
if (isGlobalVariable) {
addToAccelTable = true;
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
@@ -1106,7 +1107,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() &&
!GVContext.isFile() && !isSubprogramContext(GVContext)) {
// Create specification DIE.
- DIE *VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
+ VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification,
dwarf::DW_FORM_ref4, VariableDIE);
addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);
@@ -1135,13 +1136,15 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block);
}
- if (addToAccelTable)
- addAccelName(GV.getName(), VariableDIE);
+ if (addToAccelTable) {
+ DIE *AddrDIE = VariableSpecDIE ? VariableSpecDIE : VariableDIE;
+ addAccelName(GV.getName(), AddrDIE);
- // If the linkage name is different than the name, go ahead and output
- // that as well into the name table.
- if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
- addAccelName(GV.getLinkageName(), VariableDIE);
+ // If the linkage name is different than the name, go ahead and output
+ // that as well into the name table.
+ if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
+ addAccelName(GV.getLinkageName(), AddrDIE);
+ }
return;
}