From 3fa38a14acca2ee81b2ee724d2bf1197d20494cf Mon Sep 17 00:00:00 2001 From: Roger Ferrer Ibanez Date: Wed, 8 Mar 2017 14:00:44 +0000 Subject: 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 --- clang/test/CodeGen/unaligned-field.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 clang/test/CodeGen/unaligned-field.c (limited to 'clang/test/CodeGen/unaligned-field.c') diff --git a/clang/test/CodeGen/unaligned-field.c b/clang/test/CodeGen/unaligned-field.c new file mode 100644 index 00000000000..5aa59c27991 --- /dev/null +++ b/clang/test/CodeGen/unaligned-field.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fms-extensions -emit-llvm < %s | FileCheck %s +// Test that __unaligned does not impact the layout of the fields. + +struct A +{ + char a; + __unaligned int b; +} a; +// CHECK: %struct.A = type { i8, i32 } + +struct A2 +{ + int b; + char a; + __unaligned int c; +} a2; +// CHECK: %struct.A2 = type { i32, i8, i32 } -- cgit v1.2.3