diff options
author | Eric Christopher <echristo@apple.com> | 2012-02-13 15:08:45 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-02-13 15:08:45 +0000 |
commit | e88a71f00e9dce979dfb409459d54c92e5075a42 (patch) | |
tree | 44b499c6e44ecebcd3699a7df50e08bb36d0024c /lib/CodeGen/CGDebugInfo.cpp | |
parent | a765b9fb05599d1eeaa9856989da2e0e9303d982 (diff) |
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
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
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<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, |