[llvm-commits] [llvm] r100058 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfDebug.cpp DwarfDebug.h
Stuart Hastings
stuart at apple.com
Wed Mar 31 16:08:46 PDT 2010
Author: stuart
Date: Wed Mar 31 18:08:46 2010
New Revision: 100058
URL: http://llvm.org/viewvc/llvm-project?rev=100058&view=rev
Log:
Reverting 100048; it broke two Frontend debug info tests.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=100058&r1=100057&r2=100058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Mar 31 18:08:46 2010
@@ -780,26 +780,12 @@
} else if (Context.isNameSpace()) {
DIE *ContextDIE = getOrCreateNameSpace(DINameSpace(Context.getNode()));
ContextDIE->addChild(Die);
- } else if (Context.isSubprogram()) {
- DIE *ContextDIE = createSubprogramDIE(DISubprogram(Context.getNode()),
- /*MakeDecl=*/false);
- ContextDIE->addChild(Die);
} else if (DIE *ContextDIE = ModuleCU->getDIE(Context.getNode()))
ContextDIE->addChild(Die);
else
ModuleCU->addDie(Die);
}
-/// isFunctionContext - True if given Context is nested within a function.
-bool DwarfDebug::isFunctionContext(DIE *context) {
- if (context == (DIE *)0)
- return false;
- if (context->getTag() == dwarf::DW_TAG_subprogram)
- return true;
- else
- return isFunctionContext(context->getParent());
-}
-
/// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
/// given DIType.
DIE *DwarfDebug::getOrCreateTypeDIE(DIType Ty) {
@@ -981,10 +967,6 @@
if (DIDescriptor(ContainingType.getNode()).isCompositeType())
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
getOrCreateTypeDIE(DIType(ContainingType.getNode())));
- else {
- DIDescriptor Context = CTy.getContext();
- addToContextOwner(&Buffer, Context);
- }
break;
}
default:
@@ -1343,7 +1325,8 @@
// function then gdb prefers the definition at top level and but does not
// expect specification DIE in parent function. So avoid creating
// specification DIE for a function defined inside a function.
- if (SP.isDefinition() && !isFunctionContext(SPDie->getParent())) {
+ if (SP.isDefinition() && !SP.getContext().isCompileUnit() &&
+ !SP.getContext().isFile() && !SP.getContext().isSubprogram()) {
addUInt(SPDie, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag, 1);
// Add arguments.
@@ -1771,15 +1754,19 @@
void DwarfDebug::constructSubprogramDIE(MDNode *N) {
DISubprogram SP(N);
+ // Check for pre-existence.
+ if (ModuleCU->getDIE(N))
+ return;
+
if (!SP.isDefinition())
// This is a method declaration which will be handled while constructing
// class type.
return;
- // Check for pre-existence.
- DIE *SubprogramDie = ModuleCU->getDIE(N);
- if (!SubprogramDie)
- SubprogramDie = createSubprogramDIE(SP);
+ DIE *SubprogramDie = createSubprogramDIE(SP);
+
+ // Add to map.
+ ModuleCU->insertDIE(N, SubprogramDie);
// Add to context owner.
addToContextOwner(SubprogramDie, SP.getContext());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=100058&r1=100057&r2=100058&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Mar 31 18:08:46 2010
@@ -315,9 +315,6 @@
/// addToContextOwner - Add Die into the list of its context owner's children.
void addToContextOwner(DIE *Die, DIDescriptor Context);
- /// isFunctionContext - True if given Context is nested within a function.
- bool isFunctionContext(DIE *context);
-
/// addType - Add a new type attribute to the specified entity.
void addType(DIE *Entity, DIType Ty);
More information about the llvm-commits
mailing list