From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CodeGen/ms_struct-bitfield-init.c | 68 ++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 clang/test/CodeGen/ms_struct-bitfield-init.c (limited to 'clang/test/CodeGen/ms_struct-bitfield-init.c') diff --git a/clang/test/CodeGen/ms_struct-bitfield-init.c b/clang/test/CodeGen/ms_struct-bitfield-init.c new file mode 100644 index 0000000..7a483fb --- /dev/null +++ b/clang/test/CodeGen/ms_struct-bitfield-init.c @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s +// rdar://8823265 + +extern void abort(void); +#define ATTR __attribute__((__ms_struct__)) + +struct +{ + char foo; + long : 0; + char : 0; + int : 0; + char bar; +} ATTR t1 = {'a', 'b'}; + +struct +{ + char bar0; + long : 0; + int : 0; + char bar1; + char bar2; + long : 0; + char bar3; + char bar4; + char : 0; + char bar5; + char bar6; + char : 0; + char bar7; + char bar8; +} ATTR t2 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}; + +struct { + int : 0; + int i1; + int : 0; + int i2; + int : 0; + int i3; + int : 0; + int i4; +} t3 = {1,2,3,4}; + +int main() { + if (sizeof(t1) != 2) + abort(); + if (t1.foo != 'a') + abort(); + if (t1.bar != 'b') + abort(); + t1.foo = 'c'; + t1.bar = 'd'; + if (t1.foo != 'c') + abort(); + if (t1.bar != 'd') + abort(); + if (sizeof(t2) != 9) + abort(); + if (t2.bar0 != 'a' || t2.bar8 != 'i') + abort(); + if (sizeof(t3) != 16) + abort(); + if (t3.i1 != 1 || t3.i4 != 4) + abort(); + return 0; +} + -- cgit v1.2.3