Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 30 Apr 2014 22:58:19 +0000 (22:58 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 30 Apr 2014 22:58:19 +0000 (22:58 +0000)
Breaks GDB buildbot
(http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/14517)

GCC emits DW_AT_object_pointer /everywhere/ (declaration, abstract
definition, inlined subroutine), but it looks like GCC relies on it
being somewhere other than the declaration, at least. I'll experiment
further & can hopefully still remove it from the inlined_subroutine.

This reverts commit r207705.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207719 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.h
test/DebugInfo/X86/DW_AT_object_pointer.ll
test/DebugInfo/X86/inline-member-function.ll

index 6960ec94551d904bca59352801d64bf5fbec9860..91a7b6e53aac64f9f0105b190426c5a4cabfe039 100644 (file)
@@ -557,16 +557,11 @@ DIE *DwarfDebug::createScopeChildrenDIE(
 }
 
 void DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
 }
 
 void DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
-                                           LexicalScope *Scope,
-                                           DISubprogram Sub, DIE &ScopeDIE) {
+                                           LexicalScope *Scope, DIE &ScopeDIE) {
   // We create children when the scope DIE is not null.
   SmallVector<std::unique_ptr<DIE>, 8> Children;
   if (DIE *ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children))
   // We create children when the scope DIE is not null.
   SmallVector<std::unique_ptr<DIE>, 8> Children;
   if (DIE *ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children))
-    // The declaration will have the object_pointer, otherwise put it on the
-    // definition. This happens with ObjC blocks that have object_pointer on
-    // non-member functions.
-    if (!Sub.getFunctionDeclaration())
-      TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
+    TheCU.addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
 
   // Add children
   for (auto &I : Children)
 
   // Add children
   for (auto &I : Children)
@@ -585,7 +580,7 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
 
   if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
     AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
 
   if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
     AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
-    createAndAddScopeChildren(TheCU, Scope, Sub, *ScopeDIE);
+    createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
   }
 }
 
   }
 }
 
@@ -602,7 +597,7 @@ DIE &DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
 
   DIE &ScopeDIE = updateSubprogramScopeDIE(TheCU, Sub);
 
 
   DIE &ScopeDIE = updateSubprogramScopeDIE(TheCU, Sub);
 
-  createAndAddScopeChildren(TheCU, Scope, Sub, ScopeDIE);
+  createAndAddScopeChildren(TheCU, Scope, ScopeDIE);
 
   return ScopeDIE;
 }
 
   return ScopeDIE;
 }
index e0d7ef4d893197b07f52b0e90c031d9b50af9263..f0472e93f55b668635fe8ee943f3d1074deeea18 100644 (file)
@@ -368,7 +368,7 @@ class DwarfDebug : public AsmPrinterHandler {
   std::unique_ptr<DIE> constructScopeDIE(DwarfCompileUnit &TheCU,
                                          LexicalScope *Scope);
   void createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
   std::unique_ptr<DIE> constructScopeDIE(DwarfCompileUnit &TheCU,
                                          LexicalScope *Scope);
   void createAndAddScopeChildren(DwarfCompileUnit &TheCU, LexicalScope *Scope,
-                                 DISubprogram Sub, DIE &ScopeDIE);
+                                 DIE &ScopeDIE);
   /// \brief Construct a DIE for this abstract scope.
   void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
                                            LexicalScope *Scope);
   /// \brief Construct a DIE for this abstract scope.
   void constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
                                            LexicalScope *Scope);
index d37dcf273785e36db216ca8b8bf178511fd3f0e3..2d7e1c93dd53a312c301f76e4a833aa8eaa8f3d7 100644 (file)
@@ -1164,8 +1164,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
 }
 
 /// constructSubprogramArguments - Construct function argument DIEs.
 }
 
 /// constructSubprogramArguments - Construct function argument DIEs.
-DIE *DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
-  DIE *ObjectPointer = nullptr;
+void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
   for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
     DIDescriptor Ty = Args.getElement(i);
     if (Ty.isUnspecifiedParameter()) {
   for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
     DIDescriptor Ty = Args.getElement(i);
     if (Ty.isUnspecifiedParameter()) {
@@ -1176,11 +1175,8 @@ DIE *DwarfUnit::constructSubprogramArguments(DIE &Buffer, DIArray Args) {
       addType(Arg, DIType(Ty));
       if (DIType(Ty).isArtificial())
         addFlag(Arg, dwarf::DW_AT_artificial);
       addType(Arg, DIType(Ty));
       if (DIType(Ty).isArtificial())
         addFlag(Arg, dwarf::DW_AT_artificial);
-      if (DIType(Ty).isObjectPointer())
-        ObjectPointer = &Arg;
     }
   }
     }
   }
-  return ObjectPointer;
 }
 
 /// constructTypeDIE - Construct type DIE from DICompositeType.
 }
 
 /// constructTypeDIE - Construct type DIE from DICompositeType.
@@ -1501,8 +1497,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
 
     // Add arguments. Do not add arguments for subprogram definition. They will
     // be handled while processing variables.
 
     // Add arguments. Do not add arguments for subprogram definition. They will
     // be handled while processing variables.
-    if (DIE *ObjectPointer = constructSubprogramArguments(SPDie, Args))
-      addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, *ObjectPointer);
+    constructSubprogramArguments(SPDie, Args);
   }
 
   if (SP.isArtificial())
   }
 
   if (SP.isArtificial())
index 5beae1e29c48101be43259b347b0524c10505695..b2ac647e00e2afdae936c2da747855ce088f5536 100644 (file)
@@ -418,7 +418,7 @@ public:
                                             AbstractOrInlined AbsIn = AOI_None);
 
   /// constructSubprogramArguments - Construct function argument DIEs.
                                             AbstractOrInlined AbsIn = AOI_None);
 
   /// constructSubprogramArguments - Construct function argument DIEs.
-  DIE *constructSubprogramArguments(DIE &Buffer, DIArray Args);
+  void constructSubprogramArguments(DIE &Buffer, DIArray Args);
 
   /// Create a DIE with the given Tag, add the DIE to its parent, and
   /// call insertDIE if MD is not null.
 
   /// Create a DIE with the given Tag, add the DIE to its parent, and
   /// call insertDIE if MD is not null.
index 7885514c2c6453a173240d1f8b33ceff0dfefcca..5fa96994a8be76258b49f823708a93cbb02bfd7f 100644 (file)
@@ -1,28 +1,13 @@
 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
 
-; Emit the DW_TAG_object_pointer on the declaration only, not the definition.
-; This seems the most correct thing - the DW_TAG_object_pointer is inherited
-; from the declaration to any (abstract or concrete) definitions and DWARF
-; consumers can use this information for callers that can only see the
-; declaration.
-; That said, it isn't very space efficient - making member function
-; declarations 11 bytes instead of 7 and I'm not sure which tools actually
-; use this information here (ObjC Blocks are a different story & most likely
-; require object_pointer) - perhaps we should omit it entirely for space.
-; No overall space impact study has been performed.
-
-; CHECK: [[DEFINITION:0x[0-9a-f]*]]: DW_TAG_subprogram
-; CHECK-NOT: DW_TAG
-; CHECK-NOT: DW_TAG_object_pointer
+; CHECK: DW_TAG_formal_parameter [
+; CHECK-NOT: ""
 ; CHECK: DW_TAG
 ; CHECK: DW_TAG
-
 ; CHECK: DW_TAG_class_type
 ; CHECK: DW_TAG_class_type
-; CHECK-NOT: NULL
-; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_name {{.*}} "A"
 ; CHECK: DW_AT_object_pointer [DW_FORM_ref4]     (cu + 0x{{[0-9a-f]*}} => {[[PARAM:0x[0-9a-f]*]]})
 ; CHECK: [[PARAM]]:     DW_TAG_formal_parameter
 ; CHECK: DW_AT_object_pointer [DW_FORM_ref4]     (cu + 0x{{[0-9a-f]*}} => {[[PARAM:0x[0-9a-f]*]]})
 ; CHECK: [[PARAM]]:     DW_TAG_formal_parameter
+; CHECK-NEXT: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x{{[0-9a-f]*}}] = "this")
 
 %class.A = type { i32 }
 
 
 %class.A = type { i32 }
 
index a3fcb99c5ced9eae45a5eb46cc5b63ef701a5ecd..4a4a19c19130b70d658040fd6ba428fd04e2002e 100644 (file)
 ; CHECK-NOT: DW_AT_artificial
 ; CHECK: DW_TAG
 
 ; CHECK-NOT: DW_AT_artificial
 ; CHECK: DW_TAG
 
-; But make sure we emit DW_AT_object_pointer on the declaration.
-; CHECK: DW_TAG_structure_type
-; CHECK-NEXT: DW_AT_name {{.*}} "foo"
-; CHECK-NOT: NULL
-; CHECK: [[DECLARATION:0x[0-9a-e]*]]: DW_TAG_subprogram
-; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_object_pointer
-
-; But don't put it on the abstract definition, either.
+; But make sure we emit DW_AT_object_pointer on the abstract definition.
 ; CHECK: [[ABSTRACT_ORIGIN]]: DW_TAG_subprogram
 ; CHECK: [[ABSTRACT_ORIGIN]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_specification {{.*}}{[[DECLARATION]]}
 ; CHECK-NOT: NULL
 ; CHECK-NOT: NULL
-; CHECK-NOT: DW_AT_object_pointer
-; CHECK: DW_TAG_formal_parameter
+; CHECK-NOT: TAG
+; CHECK: DW_AT_object_pointer
 
 %struct.foo = type { i8 }
 
 
 %struct.foo = type { i8 }