summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-10-17 01:31:12 +0000
committerEric Christopher <echristo@gmail.com>2013-10-17 01:31:12 +0000
commitbdfed1687b4288f7edb6faa637774bce903810c8 (patch)
tree0c2059580c432fdc12526f3637c97ed4176b1293 /lib
parentb74b88edac9ab490ba428aef0bdebc957399bbd7 (diff)
downloadllvm-bdfed1687b4288f7edb6faa637774bce903810c8.tar.gz
llvm-bdfed1687b4288f7edb6faa637774bce903810c8.tar.bz2
llvm-bdfed1687b4288f7edb6faa637774bce903810c8.tar.xz
Add the subprogram DIEs to the context they're created with only
if they're a declaration, otherwise they're owned by the compile unit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index b6ea6a4166..fb9e59958a 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1321,9 +1321,6 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
DeclDie = getOrCreateSubprogramDIE(SPDecl);
}
- // Add to context owner.
- ContextDIE->addChild(SPDie);
-
// Add function template parameters.
addTemplateParams(*SPDie, SP.getTemplateParams());
@@ -1333,9 +1330,15 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
// Refer function declaration directly.
addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
+ // Add subprogram definitions to the CU die directly.
+ CUDie.get()->addChild(SPDie);
+
return SPDie;
}
+ // Add to context owner.
+ ContextDIE->addChild(SPDie);
+
// Add the linkage name if we have one.
StringRef LinkageName = SP.getLinkageName();
if (!LinkageName.empty())