2010-04-17 04:56:35 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
|
2009-01-30 20:58:18 +08:00
|
|
|
|
2009-01-30 01:44:32 +08:00
|
|
|
struct foo {
|
|
|
|
void *a;
|
|
|
|
int b;
|
|
|
|
};
|
|
|
|
|
2010-04-17 04:56:35 +08:00
|
|
|
// CHECK: @u = global %union.anon zeroinitializer
|
2009-01-30 01:44:32 +08:00
|
|
|
union { int i; float f; } u = { };
|
|
|
|
|
2010-04-17 04:56:35 +08:00
|
|
|
// CHECK: @u2 = global %0 { i32 0, [4 x i8] undef }
|
|
|
|
union { int i; double f; } u2 = { };
|
2009-03-28 07:40:29 +08:00
|
|
|
|
2010-04-17 05:19:39 +08:00
|
|
|
// CHECK: @u3 = global %1 zeroinitializer
|
|
|
|
union { double f; int i; } u3 = { };
|
|
|
|
|
2010-04-17 04:56:35 +08:00
|
|
|
// CHECK: @b = global [2 x i32] [i32 0, i32 22]
|
2009-03-28 07:40:29 +08:00
|
|
|
int b[2] = {
|
2010-04-17 04:56:35 +08:00
|
|
|
[1] = 22
|
2009-03-28 07:40:29 +08:00
|
|
|
};
|
2010-04-17 04:56:35 +08:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
// CHECK: internal global %struct.foo { i8* null, i32 1024 }
|
|
|
|
static struct foo foo = {
|
|
|
|
.b = 1024,
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: bitcast %union.anon* %u2
|
|
|
|
// CHECK: call void @llvm.memset
|
|
|
|
union { int i; float f; } u2 = { };
|
|
|
|
|
|
|
|
// CHECK-NOT: call void @llvm.memset
|
|
|
|
union { int i; float f; } u3;
|
|
|
|
|
|
|
|
// CHECK: ret i32
|
|
|
|
}
|