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/CodeGen/CodeGenFunction.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/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index bad963b6fa3..5f793f8e775 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -149,6 +149,8 @@ CharUnits CodeGenFunction::getNaturalTypeAlignment(QualType T, Alignment = CGM.getClassPointerAlignment(RD); } else { Alignment = getContext().getTypeAlignInChars(T); + if (T.getQualifiers().hasUnaligned()) + Alignment = CharUnits::One(); } // Cap to the global maximum type alignment unless the alignment |