From: Anders Carlsson Date: Fri, 10 Apr 2009 05:31:15 +0000 (+0000) Subject: Use correct alignment and size for references in records as well. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f1169f45b915c40c6f330af69e4e13dd18a5084;p=clang Use correct alignment and size for references in records as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68769 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index ef4ff1526e..25ab97e7c7 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -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 FieldInfo = Context.getTypeInfo(FD->getType());