]> granicus.if.org Git - clang/commitdiff
Add back in the code to create forward decls using temporary mdnodes.
authorEric Christopher <echristo@apple.com>
Mon, 13 Feb 2012 15:08:45 +0000 (15:08 +0000)
committerEric Christopher <echristo@apple.com>
Mon, 13 Feb 2012 15:08:45 +0000 (15:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150390 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index f6166ca8ae9ba78061a7ae19e480ee5bb92de1f7..34da5f4d998fd45b9e52da488a53e3043919e195 100644 (file)
@@ -483,26 +483,27 @@ llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty,
 // 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,