[llvm] r210379 - DebugInfo: Use the scope of the function declaration, if any, to name a function in DWARF pubnames
David Blaikie
dblaikie at gmail.com
Fri Jun 6 15:29:05 PDT 2014
Author: dblaikie
Date: Fri Jun 6 17:29:05 2014
New Revision: 210379
URL: http://llvm.org/viewvc/llvm-project?rev=210379&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll
llvm/trunk/test/DebugInfo/dwarf-public-names.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=210379&r1=210378&r2=210379&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 6 17:29:05 2014
@@ -531,8 +531,7 @@ void DwarfDebug::constructAbstractSubpro
// 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::finishSubprogramDefinit
// 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);
}
}
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=210379&r1=210378&r2=210379&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Fri Jun 6 17:29:05 2014
@@ -1401,6 +1401,13 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE
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;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=210379&r1=210378&r2=210379&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Fri Jun 6 17:29:05 2014
@@ -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.
Modified: llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll?rev=210379&r1=210378&r2=210379&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarf-public-names.ll Fri Jun 6 17:29:05 2014
@@ -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 }
Modified: llvm/trunk/test/DebugInfo/dwarf-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarf-public-names.ll?rev=210379&r1=210378&r2=210379&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Fri Jun 6 17:29:05 2014
@@ -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 }
More information about the llvm-commits
mailing list