From: Eric Christopher Date: Mon, 13 Feb 2012 15:08:45 +0000 (+0000) Subject: Add back in the code to create forward decls using temporary mdnodes. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e88a71f00e9dce979dfb409459d54c92e5075a42;p=clang Add back in the code to create forward decls using temporary mdnodes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150390 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index f6166ca8ae..34da5f4d99 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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(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,