[llvm-commits] [dragonegg] r112406 - /dragonegg/trunk/llvm-debug.cpp

Duncan Sands baldrick at free.fr
Sat Aug 28 21:35:43 PDT 2010


Author: baldrick
Date: Sat Aug 28 23:35:43 2010
New Revision: 112406

URL: http://llvm.org/viewvc/llvm-project?rev=112406&view=rev
Log:
Port commit 111841 (djg) from llvm-gcc:
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:
    dragonegg/trunk/llvm-debug.cpp

Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=112406&r1=112405&r2=112406&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Sat Aug 28 23:35:43 2010
@@ -782,19 +782,22 @@
     if (MDNode *TN = dyn_cast_or_null<MDNode>(I->second))
       return DIType(TN);
 
-  llvm::DICompositeType FwdDecl =
-    DebugFactory.CreateCompositeType(Tag,
-                                     TyContext,
-                                     FwdName.c_str(),
-                                     getOrCreateFile(Loc.file),
-                                     Loc.line,
-                                     0, 0, 0, SFlags | llvm::DIType::FlagFwdDecl,
-                                     llvm::DIType(), llvm::DIArray(),
-                                     RunTimeLang);
-
   // forward declaration,
-  if (TYPE_SIZE(type) == 0)
+  if (TYPE_SIZE(type) == 0) {
+    llvm::DICompositeType FwdDecl =
+      DebugFactory.CreateCompositeType(Tag,
+                                       TyContext,
+                                       FwdName.c_str(),
+                                       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