зеркало из https://github.com/microsoft/clang-1.git
Fix another debug info crash with virtual bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94520 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
4433f1cf8a
Коммит
e70d391ed5
|
@ -615,21 +615,28 @@ CollectCXXBases(const CXXRecordDecl *Decl,
|
|||
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);
|
||||
|
|
|
@ -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 @@ namespace VirtualDtor {
|
|||
|
||||
Y::~Y() { }
|
||||
}
|
||||
|
||||
namespace VirtualBase {
|
||||
struct A { };
|
||||
struct B : virtual A { };
|
||||
|
||||
void f() {
|
||||
B b;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче