summaryrefslogtreecommitdiffstats
path: root/test/Layout/ms_struct-bitfields.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
committerdim <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
commit3176e97f130184ece0e1a21352c8124cc83ff24a (patch)
tree0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/Layout/ms_struct-bitfields.c
parent1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff)
downloadFreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip
FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'test/Layout/ms_struct-bitfields.c')
-rw-r--r--test/Layout/ms_struct-bitfields.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/Layout/ms_struct-bitfields.c b/test/Layout/ms_struct-bitfields.c
new file mode 100644
index 0000000..9cb455b
--- /dev/null
+++ b/test/Layout/ms_struct-bitfields.c
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple armv7-apple-darwin -fdump-record-layouts %s 2>/dev/null \
+// RUN: | FileCheck %s
+
+// rdar://22275433
+
+#pragma ms_struct on
+
+union A {
+ unsigned long long x : 32;
+ unsigned long long y : 32;
+} a;
+// CHECK:*** Dumping AST Record Layout
+// CHECK-NEXT: 0 | union A
+// CHECK-NEXT: 0:0-31 | unsigned long long x
+// CHECK-NEXT: 0:0-31 | unsigned long long y
+// CHECK-NEXT: | [sizeof=8, align=1]
+
+union B {
+ __attribute__((aligned(4)))
+ unsigned long long x : 32;
+ unsigned long long y : 32;
+} b;
+// CHECK:*** Dumping AST Record Layout
+// CHECK-NEXT: 0 | union B
+// CHECK-NEXT: 0:0-31 | unsigned long long x
+// CHECK-NEXT: 0:0-31 | unsigned long long y
+// CHECK-NEXT: | [sizeof=8, align=1]
+
+union C {
+ unsigned long long : 0;
+ unsigned short y : 8;
+} c;
+// CHECK:*** Dumping AST Record Layout
+// CHECK-NEXT: 0 | union C
+// CHECK-NEXT: 0:- | unsigned long long
+// CHECK-NEXT: 0:0-7 | unsigned short y
+// CHECK-NEXT: | [sizeof=2, align=1]
+
+union D {
+ unsigned long long : 0;
+ unsigned short : 0;
+} d;
+// CHECK:*** Dumping AST Record Layout
+// CHECK-NEXT: 0 | union D
+// CHECK-NEXT: 0:- | unsigned long long
+// CHECK-NEXT: 0:- | unsigned short
+// CHECK-NEXT: | [sizeof=1, align=1]
+
OpenPOWER on IntegriCloud