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 | ac0afca9c16b8910f99b407baf99eb0079afcb46 (patch) | |
tree | 694b3241a3cfd9e636c01023a76e2eb5495fe022 /lib/CodeGen/CodeGenFunction.cpp | |
parent | daad58b44fcc39de10e1a38a4a4e6aaa3c8ed01a (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index bad963b6fa..5f793f8e77 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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 |