diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ef4ff1526e58..25ab97e7c7ec 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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());