Use correct alignment and size for references in records as well.

llvm-svn: 68769
This commit is contained in:
Anders Carlsson 2009-04-10 05:31:15 +00:00
parent b0001322e0
commit b36338aa00
1 changed files with 4 additions and 0 deletions

View File

@ -580,6 +580,10 @@ void ASTRecordLayout::LayoutField(const FieldDecl *FD, unsigned FieldNo,
FieldSize = 0;
const ArrayType* ATy = Context.getAsArrayType(FD->getType());
FieldAlign = Context.getTypeAlign(ATy->getElementType());
} else if (const ReferenceType *RT = FD->getType()->getAsReferenceType()) {
unsigned AS = RT->getPointeeType().getAddressSpace();
FieldSize = Context.Target.getPointerWidth(AS);
FieldAlign = Context.Target.getPointerAlign(AS);
} else {
std::pair<uint64_t, unsigned> FieldInfo =
Context.getTypeInfo(FD->getType());