summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-04-10 05:31:15 +0000
committerAnders Carlsson <andersca@mac.com>2009-04-10 05:31:15 +0000
commitb36338aa007a4afbaf452d6e13d85a2907edb5e6 (patch)
treee33c278608b4f21c6df70faae9aa2c185a66d3b5 /clang/lib/AST
parentb0001322e06232c0c70af7f80bb2021c9a87a290 (diff)
downloadbcm5719-llvm-b36338aa007a4afbaf452d6e13d85a2907edb5e6.tar.gz
bcm5719-llvm-b36338aa007a4afbaf452d6e13d85a2907edb5e6.zip
Use correct alignment and size for references in records as well.
llvm-svn: 68769
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index ef4ff1526e5..25ab97e7c7e 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<uint64_t, unsigned> FieldInfo =
Context.getTypeInfo(FD->getType());
OpenPOWER on IntegriCloud