1 // RUN: %clang_cc1 -std=c++98 -emit-llvm -o - %s -triple x86_64-linux-gnu | FileCheck %s
2 // RUN: %clang_cc1 -std=c++11 -emit-llvm -o - %s -triple x86_64-linux-gnu | FileCheck %s
4 struct A
{ int x
, y
[3]; };
7 // CHECK: @b ={{.*}} global %{{[^ ]*}} { %{{[^ ]*}} { i32 1, [3 x i32] [i32 2, i32 5, i32 4] } }
8 B b
= {(A
){1, 2, 3, 4}, .a
.y
[1] = 5};
22 // CHECK: @d1 = {{.*}} { i32 1, [3 x %[[U:.*]]] [%[[U]] { i32 2 }, %[[U]] { i32 5 }, %[[U]] { i32 4 }] }
23 D d1
= {(C
){1, {{.n
=2}, {.f
=3}, {.n
=4}}}, .c
.u
[1].n
= 5};
25 // CHECK: @d2 = {{.*}} { i32 1, { %[[U]], float, %[[U]] } { %[[U]] { i32 2 }, float 5.{{0*}}e+00, %[[U]] { i32 4 } } }
26 D d2
= {(C
){1, 2, 3, 4}, .c
.u
[1].f
= 5};
37 // CHECK: @bitfield = {{.*}} { i32 1, { i8, i8, [2 x i8] } { i8 42, i8 2, [2 x i8] undef } }
38 WithBitfield bitfield
= {1, (Bitfield
){2, 3, 4}, .b
.b
= 5};
41 const char buffer
[12];
46 // CHECK: @string = {{.*}} [12 x i8] c"Hello World\00" } }
47 WithString string
= {(String
){"hello world"}, .str
.buffer
[0] = 'H', .str
.buffer
[6] = 'W'};
52 struct WithLargeArray
{
55 // CHECK: @large ={{.*}} global { { <{ [11 x i32], [4085 x i32] }> } } { { <{ [11 x i32], [4085 x i32] }> } { <{ [11 x i32], [4085 x i32] }> <{ [11 x i32] [i32 1, i32 2, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 10], [4085 x i32] zeroinitializer }> } }
56 WithLargeArray large
= {(LargeArray
){1, 2, 3}, .arr
.arr
[10] = 10};
58 union OverwritePaddingWithBitfield
{
59 struct Padding
{ unsigned : 8; char c
; } padding
;
62 struct WithOverwritePaddingWithBitfield
{
63 OverwritePaddingWithBitfield a
;
65 // CHECK: @overwrite_padding ={{.*}} global { { i8, i8 } } { { i8, i8 } { i8 3, i8 1 } }
66 WithOverwritePaddingWithBitfield overwrite_padding
= {(OverwritePaddingWithBitfield
){1}, .a
.bitfield
= 3};