[llvm] r188577 - DebugInfo: Allow the addition of other (such as static data) members to a record type after construction

David Blaikie dblaikie at gmail.com
Fri Aug 16 13:42:15 PDT 2013


Author: dblaikie
Date: Fri Aug 16 15:42:14 2013
New Revision: 188577

URL: http://llvm.org/viewvc/llvm-project?rev=188577&view=rev
Log:
DebugInfo: Allow the addition of other (such as static data) members to a record type after construction

Plus a type cleanup & minor fix to enumerate members of declarations.

Modified:
    llvm/trunk/include/llvm/DIBuilder.h
    llvm/trunk/include/llvm/DebugInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/trunk/lib/IR/DIBuilder.cpp
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/DIBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DIBuilder.h?rev=188577&r1=188576&r2=188577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DIBuilder.h (original)
+++ llvm/trunk/include/llvm/DIBuilder.h Fri Aug 16 15:42:14 2013
@@ -419,9 +419,11 @@ namespace llvm {
     DIType createObjectPointerType(DIType Ty);
 
     /// createForwardDecl - Create a temporary forward-declared type.
-    DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
-                             DIFile F, unsigned Line, unsigned RuntimeLang = 0,
-                             uint64_t SizeInBits = 0, uint64_t AlignInBits = 0);
+    DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
+                                      DIDescriptor Scope, DIFile F,
+                                      unsigned Line, unsigned RuntimeLang = 0,
+                                      uint64_t SizeInBits = 0,
+                                      uint64_t AlignInBits = 0);
 
     /// retainType - Retain DIType in a module even if it is not referenced
     /// through debug info anchors.

Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=188577&r1=188576&r2=188577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Fri Aug 16 15:42:14 2013
@@ -323,7 +323,7 @@ namespace llvm {
 
     DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
     void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
-    void addMember(DISubprogram S);
+    void addMember(DIDescriptor D);
     unsigned getRunTimeLang() const { return getUnsignedField(11); }
     DICompositeType getContainingType() const {
       return getFieldAs<DICompositeType>(12);

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=188577&r1=188576&r2=188577&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Aug 16 15:42:14 2013
@@ -981,9 +981,6 @@ void CompileUnit::constructTypeDIE(DIE &
   case dwarf::DW_TAG_structure_type:
   case dwarf::DW_TAG_union_type:
   case dwarf::DW_TAG_class_type: {
-    if (CTy.isForwardDecl())
-      break;
-
     // Add elements to structure type.
     DIArray Elements = CTy.getTypeArray();
     for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {

Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=188577&r1=188576&r2=188577&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Fri Aug 16 15:42:14 2013
@@ -844,7 +844,7 @@ DIDescriptor DIBuilder::createUnspecifie
 
 /// createForwardDecl - Create a temporary forward-declared type that
 /// can be RAUW'd if the full type is seen.
-DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
+DICompositeType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
                                     DIDescriptor Scope, DIFile F,
                                     unsigned Line, unsigned RuntimeLang,
                                     uint64_t SizeInBits,
@@ -863,11 +863,12 @@ DIType DIBuilder::createForwardDecl(unsi
                      DIDescriptor::FlagFwdDecl),
     NULL,
     DIArray(),
-    ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)
+    ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
+    NULL
   };
   MDNode *Node = MDNode::getTemporary(VMContext, Elts);
-  DIType RetTy(Node);
-  assert(RetTy.isType() &&
+  DICompositeType RetTy(Node);
+  assert(RetTy.isCompositeType() &&
          "createForwardDecl result should be a DIType");
   return RetTy;
 }

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=188577&r1=188576&r2=188577&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Fri Aug 16 15:42:14 2013
@@ -647,7 +647,7 @@ void DICompositeType::setTypeArray(DIArr
   DbgNode = N;
 }
 
-void DICompositeType::addMember(DISubprogram S) {
+void DICompositeType::addMember(DIDescriptor D) {
   SmallVector<llvm::Value *, 16> M;
   DIArray OrigM = getTypeArray();
   unsigned Elements = OrigM.getNumElements();
@@ -656,7 +656,7 @@ void DICompositeType::addMember(DISubpro
   M.reserve(Elements + 1);
   for (unsigned i = 0; i != Elements; ++i)
     M.push_back(OrigM.getElement(i));
-  M.push_back(S);
+  M.push_back(D);
   setTypeArray(DIArray(MDNode::get(DbgNode->getContext(), M)));
 }
 





More information about the llvm-commits mailing list