66 lines · c
1// RUN: %clang_cc1 -triple i386-apple-darwin10 -mms-bitfields -emit-llvm %s -o - | FileCheck %s2 3struct s1 {4 int f32;5 long long f64;6} s1;7 8// CHECK: %struct.s1 = type { i32, [4 x i8], i64 }9 10struct s2 {11 int f32;12 long long f64[4];13} s2;14 15// CHECK: %struct.s2 = type { i32, [4 x i8], [4 x i64] }16 17struct s3 {18 int f32;19 struct s1 s;20} s3;21 22// CHECK: %struct.s3 = type { i32, [4 x i8], %struct.s1 }23 24// PR32482:25 26#pragma pack (push,1)27 28typedef unsigned int UINT32;29 30struct Inner {31 UINT32 A : 1;32 UINT32 B : 1;33 UINT32 C : 1;34 UINT32 D : 30;35} Inner;36 37#pragma pack (pop)38 39// CHECK: %struct.Inner = type { i32, i32 }40 41// CHECK: %struct.A = type { i32, i32, i32 }42 43#pragma pack(push, 1)44 45union HEADER {46 struct A {47 int : 3; // Bits 2:048 int a : 9; // Bits 11:349 int : 12; // Bits 23:1250 int b : 17; // Bits 40:2451 int : 7; // Bits 47:4152 int c : 4; // Bits 51:4853 int : 4; // Bits 55:5254 int d : 3; // Bits 58:5655 int : 5; // Bits 63:5956 } Bits;57} HEADER;58 59#pragma pack(pop)60 61struct Inner variable = { 1,0,1, 21 };62union HEADER hdr = {{1,2,3,4}};63 64// CHECK: @variable ={{.*}} global { i8, [3 x i8], i8, i8, i8, i8 } { i8 5, [3 x i8] zeroinitializer, i8 21, i8 0, i8 0, i8 0 }, align 165// CHECK: @hdr ={{.*}} global { { i8, i8, [2 x i8], i8, i8, i8, i8, i8, [3 x i8] } } { { i8, i8, [2 x i8], i8, i8, i8, i8, i8, [3 x i8] } { i8 8, i8 0, [2 x i8] zeroinitializer, i8 2, i8 0, i8 0, i8 3, i8 4, [3 x i8] zeroinitializer } }, align 166