Fix the clang-wpa example.
[clang.git] / test / CodeGen / staticinit.c
blob8c5cdd05642d2333a086b6875a54af2370600b29
1 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
2 // RUN: grep "g.b = internal global i8. getelementptr" %t
4 struct AStruct {
5 int i;
6 char *s;
7 double d;
8 };
10 void f() {
11 static int i = 42;
12 static int is[] = { 1, 2, 3, 4 };
13 static char* str = "forty-two";
14 static char* strs[] = { "one", "two", "three", "four" };
15 static struct AStruct myStruct = { 1, "two", 3.0 };
18 void g() {
19 static char a[10];
20 static char *b = a;
23 struct s { void *p; };
25 void foo(void) {
26 static struct s var = {((void*)&((char*)0)[0])};
29 // RUN: grep "f1.l0 = internal global i32 ptrtoint (i32 ()\* @f1 to i32)" %t
30 int f1(void) { static int l0 = (unsigned) f1; }
32 // PR7044
33 char *f2(char key) {
34 switch (key) {
35 static char _msg[40];
36 case '\014':
37 return _msg;
40 return 0;