Move type handling to make sure we get all created types that aren't
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfCompileUnit.cpp
index a68da04907c11465c7e213744af95ec5af575564..d440a746197160ad74756194ed416b177eae1631 100644 (file)
@@ -605,7 +605,11 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
     assert(Ty.isDerivedType() && "Unknown kind of DIType");
     constructTypeDIE(*TyDIE, DIDerivedType(Ty));
   }
     assert(Ty.isDerivedType() && "Unknown kind of DIType");
     constructTypeDIE(*TyDIE, DIDerivedType(Ty));
   }
-
+  // If this is a named finished type then include it in the list of types
+  // for the accelerator tables.
+  if (!Ty.getName().empty() && !Ty.isForwardDecl())
+    addAccelType(Ty.getName(), TyDIE);
+  
   addToContextOwner(TyDIE, Ty.getContext());
   return TyDIE;
 }
   addToContextOwner(TyDIE, Ty.getContext());
   return TyDIE;
 }
@@ -634,12 +638,6 @@ 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);
   // If this is a complete composite type then include it in the
   // list of global types.
   addGlobalType(Ty);
-
-  // If this is a named finished type then include it in the list of types
-  // for the accelerator tables.
-  if (!Ty.getName().empty() && !Ty.isForwardDecl())
-    if (DIEEntry *Entry = getDIEEntry(Ty))
-      AccelTypes[Ty.getName()] = Entry->getEntry();
 }
 
 /// addGlobalType - Add a new global type to the compile unit.
 }
 
 /// addGlobalType - Add a new global type to the compile unit.