Incomplete type may not have corresponding DIE, so do not check DIEEntry eagerly.
authorDevang Patel <dpatel@apple.com>
Wed, 1 Jun 2011 00:23:24 +0000 (00:23 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 1 Jun 2011 00:23:24 +0000 (00:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132377 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

index f128308fb6df8c645390de546c7d46bf8cf0d696..bff1a3529984eb0f55a2a61d6616e53edb15c6e9 100644 (file)
@@ -609,16 +609,17 @@ void CompileUnit::addType(DIE *Entity, DIType Ty) {
 
   // If this is a complete composite type then include it in the
   // list of global types.
-  addGlobalType(Ty, Entry->getEntry());
+  addGlobalType(Ty);
 }
 
 /// addGlobalType - Add a new global type to the compile unit.
 ///
-void CompileUnit::addGlobalType(DIType Ty, DIE *Die) {
+void CompileUnit::addGlobalType(DIType Ty) {
   DIDescriptor Context = Ty.getContext();
   if (Ty.isCompositeType() && !Ty.getName().empty() && !Ty.isForwardDecl() 
       && (Context.isCompileUnit() || Context.isFile() || Context.isNameSpace()))
-    GlobalTypes[Ty.getName()] = Die;
+    if (DIEEntry *Entry = getDIEEntry(Ty))
+      GlobalTypes[Ty.getName()] = Entry->getEntry();
 }
 
 /// addPubTypes - Add type for pubtypes section.
@@ -633,7 +634,7 @@ void CompileUnit::addPubTypes(DISubprogram SP) {
     DIType ATy(Args.getElement(i));
     if (!ATy.Verify())
       continue;
-    addGlobalType(ATy, getDIEEntry(ATy)->getEntry());
+    addGlobalType(ATy);
   }
 }
 
index 3cfbd73ef828cd6d0a99a1a94af6358262789321..60a9b2872b41c9ab82957c9ab6b2b9fa20c262f3 100644 (file)
@@ -87,7 +87,7 @@ public:
 
   /// addGlobalType - Add a new global type to the compile unit.
   ///
-  void addGlobalType(DIType Ty, DIE *Die);
+  void addGlobalType(DIType Ty);
 
   /// getDIE - Returns the debug information entry map slot for the
   /// specified debug variable.