forked from OSchip/llvm-project
Some minor changes toward support of data
member access in the presense of non-virtual bases. llvm-svn: 77246
This commit is contained in:
parent
1b763293a6
commit
7b2b1ec6b1
|
@ -199,6 +199,10 @@ bool CGRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
|
|||
const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
|
||||
|
||||
unsigned FieldNo = 0;
|
||||
// FIXME. This will probably change when virtual bases are supported.
|
||||
if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(D))
|
||||
FieldNo += CXXRD->getNumBases();
|
||||
|
||||
for (RecordDecl::field_iterator Field = D->field_begin(),
|
||||
FieldEnd = D->field_end(); Field != FieldEnd; ++Field, ++FieldNo) {
|
||||
if (!LayoutField(*Field, Layout.getFieldOffset(FieldNo))) {
|
||||
|
|
|
@ -415,6 +415,21 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
|
|||
/// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
|
||||
/// enum.
|
||||
const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
|
||||
|
||||
// FIXME. This may have to move to a better place.
|
||||
if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(TD)) {
|
||||
assert(!RD->isPolymorphic() &&
|
||||
"FIXME: We don't support polymorphic classes yet!");
|
||||
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
|
||||
e = RD->bases_end(); i != e; ++i) {
|
||||
if (!i->isVirtual()) {
|
||||
const CXXRecordDecl *Base =
|
||||
cast<CXXRecordDecl>(i->getType()->getAsRecordType()->getDecl());
|
||||
ConvertTagDeclType(Base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TagDecl's are not necessarily unique, instead use the (clang)
|
||||
// type connected to the decl.
|
||||
const Type *Key =
|
||||
|
|
|
@ -723,6 +723,10 @@ void X86_64ABIInfo::classify(QualType Ty,
|
|||
// Reset Lo class, this will be recomputed.
|
||||
Current = NoClass;
|
||||
unsigned idx = 0;
|
||||
// FIXME. This will probably change when virtual bases are supported.
|
||||
if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
|
||||
idx += CXXRD->getNumBases();
|
||||
|
||||
for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
|
||||
i != e; ++i, ++idx) {
|
||||
uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
|
||||
|
|
Loading…
Reference in New Issue