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

Devang Patel dpatel at apple.com
Mon Feb 28 14:32:45 PST 2011


Author: dpatel
Date: Mon Feb 28 16:32:45 2011
New Revision: 126691

URL: http://llvm.org/viewvc/llvm-project?rev=126691&view=rev
Log:
Use single code path to handle c++ structs and classes while generating debug info.

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=126691&r1=126690&r2=126691&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 28 16:32:45 2011
@@ -1012,14 +1012,10 @@
     DBuilder.getOrCreateArray(EltTys.data(), EltTys.size());
   llvm::MDNode *RealDecl = NULL;
 
-  if (RD->isStruct()) 
-    RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
-                                         Size, Align, 0, Elements);
-  else if (RD->isUnion())
+  if (RD->isUnion())
     RealDecl = DBuilder.createUnionType(RDContext, RDName, DefUnit, Line,
-                                         Size, Align, 0, Elements);
-  else {
-    assert(RD->isClass() && "Unknown RecordType!");
+                                        Size, Align, 0, Elements);
+  else if (CXXDecl) {
     RDName = getClassName(RD);
      // A class's primary base or the class itself contains the vtable.
     llvm::MDNode *ContainingType = NULL;
@@ -1045,7 +1041,9 @@
                                        Size, Align, 0, 0, llvm::DIType(),
                                        Elements, ContainingType,
                                        TParamsArray);
-  }
+  } else 
+    RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
+                                         Size, Align, 0, Elements);
 
   // Now that we have a real decl for the struct, replace anything using the
   // old decl with the new one.  This will recursively update the debug info.





More information about the cfe-commits mailing list