diff options
author | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2017-03-08 14:00:44 +0000 |
---|---|---|
committer | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2017-03-08 14:00:44 +0000 |
commit | 3fa38a14acca2ee81b2ee724d2bf1197d20494cf (patch) | |
tree | 76ff6316a206013d7dd35214c688e85ea4029369 /clang/lib/AST/ASTContext.cpp | |
parent | 0385ccb34abc6dd378848a6d7355a39ef06e3f40 (diff) | |
download | bcm5719-llvm-3fa38a14acca2ee81b2ee724d2bf1197d20494cf.tar.gz bcm5719-llvm-3fa38a14acca2ee81b2ee724d2bf1197d20494cf.zip |
Honor __unaligned in codegen for declarations and expressions
This patch honors the unaligned type qualifier (currently available through he
keyword __unaligned and -fms-extensions) in CodeGen. In the current form the
patch affects declarations and expressions. It does not affect fields of
classes.
Differential Revision: https://reviews.llvm.org/D30166
llvm-svn: 297276
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 922d74e487a..b9264051b63 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1473,6 +1473,8 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const { } } Align = std::max(Align, getPreferredTypeAlign(T.getTypePtr())); + if (BaseT.getQualifiers().hasUnaligned()) + Align = Target->getCharWidth(); if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { if (VD->hasGlobalStorage() && !ForAlignof) Align = std::max(Align, getTargetInfo().getMinGlobalAlign()); |