summaryrefslogtreecommitdiff
path: root/test/CodeGen/ms_struct-bitfield.c
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-04-26 23:52:16 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-04-26 23:52:16 +0000
commit62055b0618fafb4747e783ba3fedd7bc7d57d27d (patch)
treed2a0950baf9116b777be7e46c8576020a7555bf1 /test/CodeGen/ms_struct-bitfield.c
parent028ea4bf0c643e0e2a8fa086c28beb0d5b594ba7 (diff)
downloadclang-62055b0618fafb4747e783ba3fedd7bc7d57d27d.tar.gz
With ms_struct attribut, Zero-length bitfields following
non-bitfield members are ignore. // rdar://8823265 wip git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ms_struct-bitfield.c')
-rw-r--r--test/CodeGen/ms_struct-bitfield.c123
1 files changed, 123 insertions, 0 deletions
diff --git a/test/CodeGen/ms_struct-bitfield.c b/test/CodeGen/ms_struct-bitfield.c
new file mode 100644
index 0000000000..e9bd1d3f31
--- /dev/null
+++ b/test/CodeGen/ms_struct-bitfield.c
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s
+// rdar://8823265
+
+#define ATTR __attribute__((__ms_struct__))
+
+struct
+{
+ char foo;
+ long : 0;
+ char bar;
+} ATTR t1;
+
+struct
+{
+ char foo;
+ long : 0;
+ char : 0;
+ int : 0;
+ char bar;
+} ATTR t2;
+
+struct
+{
+ char foo;
+ long : 0;
+ char : 0;
+ int : 0;
+ char bar;
+ long : 0;
+ char : 0;
+} ATTR t3;
+
+struct
+{
+ long : 0;
+ char bar;
+} ATTR t4;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+ char bar;
+} ATTR t5;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+ char bar;
+} ATTR t6;
+
+struct
+{
+ char foo;
+ long : 0;
+ int : 0;
+ char bar;
+ char bar1;
+ long : 0;
+ char bar2;
+ char bar3;
+ char : 0;
+ char bar4;
+ char bar5;
+ char : 0;
+ char bar6;
+ char bar7;
+} ATTR t7;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+} ATTR t8;
+
+struct
+{
+ char foo;
+ long : 0;
+ int : 0;
+ char bar;
+ char bar1;
+ long : 0;
+ char bar2;
+ char bar3;
+ char : 0;
+ char bar4;
+ char bar5;
+ char : 0;
+ char bar6;
+ char bar7;
+ int i1;
+ char : 0;
+ long : 0;
+ char :4;
+ char bar8;
+ char : 0;
+ char bar9;
+ char bar10;
+ int i2;
+ char : 0;
+ long : 0;
+ char :4;
+} ATTR t9;
+
+static int arr1[(sizeof(t1) == 2) -1];
+static int arr2[(sizeof(t2) == 2) -1];
+static int arr3[(sizeof(t3) == 2) -1];
+static int arr4[(sizeof(t4) == 1) -1];
+static int arr5[(sizeof(t5) == 1) -1];
+static int arr6[(sizeof(t6) == 1) -1];
+static int arr7[(sizeof(t7) == 9) -1];
+static int arr8[(sizeof(t8) == 0) -1];
+static int arr9[(sizeof(t9) == 28) -1];
+
+int main() {
+ return 0;
+}
+