summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-04-10 04:47:03 +0000
committerAnders Carlsson <andersca@mac.com>2009-04-10 04:47:03 +0000
commit9b5038ed64105d43f3b1f21e1380c75a26235862 (patch)
tree267d7893c9527c17030f455f0a15bda4ad2e197c /clang
parent7671c451086be02d832e992488fad9333042819a (diff)
downloadbcm5719-llvm-9b5038ed64105d43f3b1f21e1380c75a26235862.tar.gz
bcm5719-llvm-9b5038ed64105d43f3b1f21e1380c75a26235862.zip
Use the same alignment for reference declarations as for pointer declarations.
llvm-svn: 68761
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 7da1bf080c4..17f3d431e83 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -306,8 +306,11 @@ unsigned ASTContext::getDeclAlignInBytes(const Decl *D) {
if (const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
QualType T = VD->getType();
- // Incomplete or function types default to 1.
- if (!T->isIncompleteType() && !T->isFunctionType()) {
+ if (const ReferenceType* RT = T->getAsReferenceType()) {
+ unsigned AS = RT->getPointeeType().getAddressSpace();
+ Align = Target.getPointerWidth(AS);
+ } else if (!T->isIncompleteType() && !T->isFunctionType()) {
+ // Incomplete or function types default to 1.
while (isa<VariableArrayType>(T) || isa<IncompleteArrayType>(T))
T = cast<ArrayType>(T)->getElementType();
OpenPOWER on IntegriCloud