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

Eric Christopher echristo at apple.com
Mon Feb 13 07:08:45 PST 2012


Author: echristo
Date: Mon Feb 13 09:08:45 2012
New Revision: 150390

URL: http://llvm.org/viewvc/llvm-project?rev=150390&view=rev
Log:
Add back in the code to create forward decls using temporary mdnodes.

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=150390&r1=150389&r2=150390&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 13 09:08:45 2012
@@ -483,26 +483,27 @@
 // Creates a forward declaration for a RecordDecl in the given context.
 llvm::DIType CGDebugInfo::createRecordFwdDecl(const RecordDecl *RD,
                                               llvm::DIDescriptor Ctx) {
-
   llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
   unsigned Line = getLineNumber(RD->getLocation());
+  StringRef RDName = RD->getName();
+
+  // Get the tag.
   const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD);
-  
-  if (CXXDecl)
-    return DBuilder.createClassType(Ctx, getClassName(RD), DefUnit,
-                                    Line, 0, 0, 0,
-                                    llvm::DIType::FlagFwdDecl,
-                                    llvm::DIType(), llvm::DIArray());
+  unsigned Tag = 0;
+  if (CXXDecl) {
+    RDName = getClassName(RD);
+    Tag = llvm::dwarf::DW_TAG_class_type;
+  }
   else if (RD->isStruct())
-    return DBuilder.createStructType(Ctx, RD->getName(), DefUnit,
-                                     Line, 0, 0, llvm::DIType::FlagFwdDecl,
-                                     llvm::DIArray());
+    Tag = llvm::dwarf::DW_TAG_structure_type;
   else if (RD->isUnion())
-    return DBuilder.createUnionType(Ctx, RD->getName(), DefUnit,
-                                    Line, 0, 0, llvm::DIType::FlagFwdDecl,
-                                    llvm::DIArray());
+    Tag = llvm::dwarf::DW_TAG_union_type;
   else
     llvm_unreachable("Unknown RecordDecl type!");
+
+  // Create the type.
+  return DBuilder.createForwardDecl(Tag, RDName, DefUnit,
+				    Line);
 }
 
 // Walk up the context chain and create forward decls for record decls,





More information about the cfe-commits mailing list