| Daniel Dunbar | a45cf5b | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm -o %t %s && | 
| Daniel Dunbar | c4baa06 | 2008-08-13 23:20:05 +0000 | [diff] [blame] | 2 | // RUN: grep "hello" %t | count 3 && | 
|  | 3 | // RUN: grep 'c"hello\\00"' %t | count 2 && | 
| Nuno Lopes | cb46c14 | 2008-08-13 23:28:57 +0000 | [diff] [blame] | 4 | // RUN: grep 'c"hello\\00\\00\\00"' %t | count 1 && | 
|  | 5 | // RUN: grep 'c"ola"' %t | count 1 | 
| Daniel Dunbar | c4baa06 | 2008-08-13 23:20:05 +0000 | [diff] [blame] | 6 |  | 
|  | 7 | /* Should be 3 hello string, two global (of different sizes), the rest | 
|  | 8 | are shared. */ | 
|  | 9 |  | 
|  | 10 | void f0() { | 
|  | 11 | bar("hello"); | 
|  | 12 | } | 
|  | 13 |  | 
|  | 14 | void f1() { | 
|  | 15 | static char *x = "hello"; | 
|  | 16 | bar(x); | 
|  | 17 | } | 
|  | 18 |  | 
|  | 19 | void f2() { | 
|  | 20 | static char x[] = "hello"; | 
|  | 21 | bar(x); | 
|  | 22 | } | 
|  | 23 |  | 
|  | 24 | void f3() { | 
|  | 25 | static char x[8] = "hello"; | 
|  | 26 | bar(x); | 
|  | 27 | } | 
|  | 28 |  | 
|  | 29 | void f4() { | 
|  | 30 | static struct s { | 
|  | 31 | char *name; | 
|  | 32 | } x = { "hello" }; | 
|  | 33 | gaz(&x); | 
|  | 34 | } | 
|  | 35 |  | 
| Nuno Lopes | cb46c14 | 2008-08-13 23:28:57 +0000 | [diff] [blame] | 36 | char x[3] = "ola"; |