aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp27
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,