[cfe-commits] r94520 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-info.cpp
Anders Carlsson
andersca at mac.com
Mon Jan 25 21:27:05 PST 2010
Author: andersca
Date: Mon Jan 25 23:26:39 2010
New Revision: 94520
URL: http://llvm.org/viewvc/llvm-project?rev=94520&view=rev
Log:
Fix another debug info crash with virtual bases.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=94520&r1=94519&r2=94520&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jan 25 23:26:39 2010
@@ -615,21 +615,28 @@
for (CXXRecordDecl::base_class_const_iterator BI = Decl->bases_begin(),
BE = Decl->bases_end(); BI != BE; ++BI) {
unsigned BFlags = 0;
- if (BI->isVirtual())
+ uint64_t BaseOffset;
+
+ const CXXRecordDecl *Base =
+ cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
+
+ if (BI->isVirtual()) {
+ BaseOffset = RL.getVBaseClassOffset(Base);
BFlags = llvm::DIType::FlagVirtual;
+ } else
+ BaseOffset = RL.getBaseClassOffset(Base);
+
AccessSpecifier Access = BI->getAccessSpecifier();
if (Access == clang::AS_private)
BFlags |= llvm::DIType::FlagPrivate;
else if (Access == clang::AS_protected)
BFlags |= llvm::DIType::FlagProtected;
- const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
llvm::DIType DTy =
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_inheritance,
RecordTy, llvm::StringRef(),
llvm::DICompileUnit(), 0, 0, 0,
- RL.getBaseClassOffset(Base), BFlags,
+ BaseOffset, BFlags,
getOrCreateType(BI->getType(),
Unit));
EltTys.push_back(DTy);
Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=94520&r1=94519&r2=94520&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Mon Jan 25 23:26:39 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -g
+// RUN: %clang_cc1 -emit-llvm-only -g %s
template<typename T> struct Identity {
typedef T Type;
};
@@ -41,3 +41,12 @@
Y::~Y() { }
}
+
+namespace VirtualBase {
+ struct A { };
+ struct B : virtual A { };
+
+ void f() {
+ B b;
+ }
+}
More information about the cfe-commits
mailing list