[cfe-commits] r111842 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

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


Author: djg
Date: Mon Aug 23 16:15:56 2010
New Revision: 111842

URL: http://llvm.org/viewvc/llvm-project?rev=111842&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:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=111842&r1=111841&r2=111842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Aug 23 16:15:56 2010
@@ -977,6 +977,17 @@
   unsigned Line = getLineNumber(ID->getLocation());
   unsigned RuntimeLang = TheCU.getLanguage();
 
+  // If this is just a forward declaration, return a special forward-declaration
+  // debug type.
+  if (ID->isForwardDecl()) {
+    llvm::DICompositeType FwdDecl =
+      DebugFactory.CreateCompositeType(Tag, Unit, ID->getName(),
+                                       DefUnit, Line, 0, 0, 0, 0,
+                                       llvm::DIType(), llvm::DIArray(),
+                                       RuntimeLang);
+    return FwdDecl;
+  }
+
   // To handle recursive interface, we
   // first generate a debug descriptor for the struct as a forward declaration.
   // Then (if it is a definition) we go through and get debug info for all of
@@ -985,10 +996,6 @@
   // uses of the forward declaration with the final definition.
   llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType();
 
-  // If this is just a forward declaration, return it.
-  if (ID->isForwardDecl())
-    return FwdDecl;
-
   llvm::MDNode *MN = FwdDecl;
   llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
   // Otherwise, insert it into the TypeCache so that recursive uses will find





More information about the cfe-commits mailing list