[llvm-commits] [llvm-gcc-4.2] r111841 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp

Dan Gohman gohman at apple.com
Mon Aug 23 14:14:06 PDT 2010


Author: djg
Date: Mon Aug 23 16:14:06 2010
New Revision: 111841

URL: http://llvm.org/viewvc/llvm-project?rev=111841&view=rev
Log:
Reinstate the code for emitting an initial debug type for a struct,
to handle the case where the struct is only forward-declared. In
this case, a temporary MDNode is not needed and not desired.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=111841&r1=111840&r2=111841&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Mon Aug 23 16:14:06 2010
@@ -1007,11 +1007,22 @@
     if (MDNode *TN = dyn_cast_or_null<MDNode>(I->second))
       return DIType(TN);
   
-  llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType();
-  
   // forward declaration, 
-  if (TYPE_SIZE(type) == 0) 
+  if (TYPE_SIZE(type) == 0) {
+    llvm::DICompositeType FwdDecl =
+      DebugFactory.CreateCompositeType(Tag, 
+                                       TyContext,
+                                       GetNodeName(type),
+                                       getOrCreateFile(Loc.file), 
+                                       Loc.line, 
+                                       0, 0, 0,
+                                       SFlags | llvm::DIType::FlagFwdDecl,
+                                       llvm::DIType(), llvm::DIArray(),
+                                       RunTimeLang);
     return FwdDecl;
+  }
+  
+  llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType();
   
   // Insert into the TypeCache so that recursive uses will find it.
   llvm::MDNode *FDN = FwdDecl;





More information about the llvm-commits mailing list