summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-04-15 20:12:41 +0000
committerJustin Bogner <mail@justinbogner.com>2014-04-15 20:12:41 +0000
commit399093276c9af10ab1afe5740f11fc90eed7ae63 (patch)
treef82a554ec527d2f4daf4c2904e8dcfd050e8c35a /clang/lib/AST/ASTContext.cpp
parentaac2eac4c2dbf8b6b611082a7c63884014c9d697 (diff)
downloadbcm5719-llvm-399093276c9af10ab1afe5740f11fc90eed7ae63.tar.gz
bcm5719-llvm-399093276c9af10ab1afe5740f11fc90eed7ae63.zip
AST: Respect alignment attributes on typedef'd arrays
When instantiating an array that has an alignment attribute on it, we were looking through the array type and only considering the element type for the resulting alignment. We need to make sure we take the array's requirements into account too. llvm-svn: 206317
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 0f3809d538d..8a60bebd57a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1322,7 +1322,9 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const {
Align = std::max(Align, Target->getLargeArrayAlign());
}
- // Walk through any array types while we're at it.
+ // Keep track of extra alignment requirements on the array itself, then
+ // work with the element type.
+ Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr()));
T = getBaseElementType(arrayType);
}
Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr()));
OpenPOWER on IntegriCloud