aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-02-28 22:32:45 +0000
committerDevang Patel <dpatel@apple.com>2011-02-28 22:32:45 +0000
commit5c5b5878d88767500e06a114c53434e637bbba6b (patch)
tree641aa683897f6e051d7a79cebdabdfc634ed2d51
parentc367a876d0abcf32cb443712ce2709a0491be00b (diff)
Use single code path to handle c++ structs and classes while generating debug info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126691 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index dfd9f56b12..978542a213 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1012,14 +1012,10 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
DBuilder.getOrCreateArray(EltTys.data(), EltTys.size());
llvm::MDNode *RealDecl = NULL;
- if (RD->isStruct())
- RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
- Size, Align, 0, Elements);
- else if (RD->isUnion())
+ if (RD->isUnion())
RealDecl = DBuilder.createUnionType(RDContext, RDName, DefUnit, Line,
- Size, Align, 0, Elements);
- else {
- assert(RD->isClass() && "Unknown RecordType!");
+ Size, Align, 0, Elements);
+ else if (CXXDecl) {
RDName = getClassName(RD);
// A class's primary base or the class itself contains the vtable.
llvm::MDNode *ContainingType = NULL;
@@ -1045,7 +1041,9 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
Size, Align, 0, 0, llvm::DIType(),
Elements, ContainingType,
TParamsArray);
- }
+ } else
+ RealDecl = DBuilder.createStructType(RDContext, RDName, DefUnit, Line,
+ Size, Align, 0, Elements);
// Now that we have a real decl for the struct, replace anything using the
// old decl with the new one. This will recursively update the debug info.