diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-06-06 22:29:05 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-06-06 22:29:05 +0000 |
commit | 8ef9d22f5bc501d5286e4087828f3dc0199b38f1 (patch) | |
tree | 9e550711786be82bbc0491eaad1065670ce5f15c | |
parent | ebcf48cf9eb4cb8690c37e538ab7fab7fe134bd0 (diff) | |
download | llvm-8ef9d22f5bc501d5286e4087828f3dc0199b38f1.tar.gz llvm-8ef9d22f5bc501d5286e4087828f3dc0199b38f1.tar.bz2 llvm-8ef9d22f5bc501d5286e4087828f3dc0199b38f1.tar.xz |
DebugInfo: Use the scope of the function declaration, if any, to name a function in DWARF pubnames
This ensures that member functions, for example, are entered into
pubnames with their fully qualified name, rather than inside the global
namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210379 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 7 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfUnit.h | 1 | ||||
-rw-r--r-- | test/DebugInfo/X86/dwarf-public-names.ll | 6 | ||||
-rw-r--r-- | test/DebugInfo/dwarf-public-names.ll | 6 |
5 files changed, 14 insertions, 12 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 39bff0d1f7..433cc3769e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -531,8 +531,7 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU, // shouldn't be found by lookup. AbsDef = &SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, DIDescriptor()); - SPCU.applySubprogramAttributes(SP, *AbsDef); - SPCU.addGlobalName(SP.getName(), *AbsDef, resolve(SP.getContext())); + SPCU.applySubprogramAttributesToDefinition(SP, *AbsDef); SPCU.addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined); createAndAddScopeChildren(SPCU, Scope, *AbsDef); @@ -811,8 +810,7 @@ void DwarfDebug::finishSubprogramDefinitions() { // inlined versions during codegen. D = SPCU->getOrCreateSubprogramDIE(SP); // And attach the attributes - SPCU->applySubprogramAttributes(SP, *D); - SPCU->addGlobalName(SP.getName(), *D, resolve(SP.getContext())); + SPCU->applySubprogramAttributesToDefinition(SP, *D); } } } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 33cdcefb71..a42897f18f 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1401,6 +1401,13 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) { return &SPDie; } +void DwarfUnit::applySubprogramAttributesToDefinition(DISubprogram SP, DIE &SPDie) { + DISubprogram SPDecl = SP.getFunctionDeclaration(); + DIScope Context = resolve(SPDecl ? SPDecl.getContext() : SP.getContext()); + applySubprogramAttributes(SP, SPDie); + addGlobalName(SP.getName(), SPDie, Context); +} + void DwarfUnit::applySubprogramAttributes(DISubprogram SP, DIE &SPDie) { DIE *DeclDie = nullptr; StringRef DeclLinkageName; diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index acb7528353..71034442b2 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -400,6 +400,7 @@ public: DIE *getOrCreateSubprogramDIE(DISubprogram SP); void applySubprogramAttributes(DISubprogram SP, DIE &SPDie); + void applySubprogramAttributesToDefinition(DISubprogram SP, DIE &SPDie); /// getOrCreateTypeDIE - Find existing DIE or create new DIE for the /// given DIType. diff --git a/test/DebugInfo/X86/dwarf-public-names.ll b/test/DebugInfo/X86/dwarf-public-names.ll index cbfba0e805..793971a5f8 100644 --- a/test/DebugInfo/X86/dwarf-public-names.ll +++ b/test/DebugInfo/X86/dwarf-public-names.ll @@ -44,15 +44,13 @@ ; Check for each name in the output. ; LINUX-DAG: "ns" -; FIXME: This should be C::static_member_function -; LINUX-DAG: "static_member_function" +; LINUX-DAG: "C::static_member_function" ; LINUX-DAG: "global_variable" ; LINUX-DAG: "ns::global_namespace_variable" ; LINUX-DAG: "ns::global_namespace_function" ; LINUX-DAG: "global_function" ; LINUX-DAG: "C::static_member_variable" -; FIXME: This should be C::member_function -; LINUX-DAG: "member_function" +; LINUX-DAG: "C::member_function" %struct.C = type { i8 } diff --git a/test/DebugInfo/dwarf-public-names.ll b/test/DebugInfo/dwarf-public-names.ll index bedfa18355..72189641e3 100644 --- a/test/DebugInfo/dwarf-public-names.ll +++ b/test/DebugInfo/dwarf-public-names.ll @@ -41,15 +41,13 @@ ; Check for each name in the output. ; CHECK-DAG: "ns" -; FIXME: This should be C::static_member_function -; CHECK-DAG: "static_member_function" +; CHECK-DAG: "C::static_member_function" ; CHECK-DAG: "global_variable" ; CHECK-DAG: "ns::global_namespace_variable" ; CHECK-DAG: "ns::global_namespace_function" ; CHECK-DAG: "global_function" ; CHECK-DAG: "C::static_member_variable" -; FIXME: This should be C::member_function -; CHECK-DAG: "member_function" +; CHECK-DAG: "C::member_function" %struct.C = type { i8 } |