Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / stmtexpr-init.c
blobe2db75518e9a438612cd80295e8107ee892d0bbc
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
3 void escape(const void *);
5 // CHECK-DAG: internal global i8 99
7 void T1(void) {
8 const char *x[1] = {({static char _x = 99; &_x; })};
9 escape(x);
12 struct sized_array {
13 int count;
14 int entries[];
17 #define N_ARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
19 #define ARRAY_PTR(...) ({ \
20 static const struct sized_array _a = {N_ARGS(__VA_ARGS__), {__VA_ARGS__}}; \
21 &_a; \
24 struct outer {
25 const struct sized_array *a;
28 void T2(void) {
29 // CHECK-DAG: internal constant { i32, [2 x i32] } { i32 2, [2 x i32] [i32 50, i32 60] }
30 const struct sized_array *A = ARRAY_PTR(50, 60);
32 // CHECK-DAG: internal constant { i32, [3 x i32] } { i32 3, [3 x i32] [i32 10, i32 20, i32 30] }
33 struct outer X = {ARRAY_PTR(10, 20, 30)};
35 escape(A);
36 escape(&X);