Douglas Gregor | 0b6bc8b | 2010-02-03 09:33:45 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s |
| 2 | |
Douglas Gregor | 516a6bc | 2010-03-08 02:45:10 +0000 | [diff] [blame] | 3 | struct Global { Global(); }; |
| 4 | template<typename T> struct X { X(); }; |
Douglas Gregor | 0b6bc8b | 2010-02-03 09:33:45 +0000 | [diff] [blame] | 5 | |
| 6 | |
| 7 | namespace { |
Douglas Gregor | 516a6bc | 2010-03-08 02:45:10 +0000 | [diff] [blame] | 8 | struct Anon { Anon(); }; |
Douglas Gregor | 0b6bc8b | 2010-02-03 09:33:45 +0000 | [diff] [blame] | 9 | |
| 10 | // CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global |
| 11 | Global anon0; |
| 12 | } |
| 13 | |
| 14 | // CHECK: @anon1 = internal global |
| 15 | Anon anon1; |
| 16 | |
| 17 | // CHECK: @anon2 = internal global |
| 18 | X<Anon> anon2; |
| 19 | |
Fariborz Jahanian | 2bf6d7b | 2010-06-21 16:08:37 +0000 | [diff] [blame] | 20 | // rdar: // 8071804 |
| 21 | char const * const xyzzy = "Hello, world!"; |
| 22 | extern char const * const xyzzy; |
| 23 | |
| 24 | char const * const *test1() |
| 25 | { |
| 26 | // CHECK: @_ZL5xyzzy = internal constant |
| 27 | return &xyzzy; |
| 28 | } |
| 29 | |
| 30 | static char const * const static_xyzzy = "Hello, world!"; |
| 31 | extern char const * const static_xyzzy; |
| 32 | |
| 33 | char const * const *test2() |
| 34 | { |
| 35 | // CHECK: @_ZL12static_xyzzy = internal constant |
| 36 | return &static_xyzzy; |
| 37 | } |
| 38 | |
| 39 | static char const * static_nonconst_xyzzy = "Hello, world!"; |
| 40 | extern char const * static_nonconst_xyzzy; |
| 41 | |
| 42 | char const * *test3() |
| 43 | { |
| 44 | // CHECK: @_ZL21static_nonconst_xyzzy = internal global |
| 45 | return &static_nonconst_xyzzy; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | char const * extern_nonconst_xyzzy = "Hello, world!"; |
| 50 | extern char const * extern_nonconst_xyzzy; |
| 51 | |
| 52 | char const * *test4() |
| 53 | { |
| 54 | // CHECK: @extern_nonconst_xyzzy = global |
| 55 | return &extern_nonconst_xyzzy; |
| 56 | } |