Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s |
Eli Friedman | 20e098b | 2009-12-11 21:23:03 +0000 | [diff] [blame] | 2 | |
| 3 | struct A { |
| 4 | A() { x = 10; } |
| 5 | int x; |
| 6 | }; |
| 7 | |
| 8 | const A x; |
| 9 | |
Sean Hunt | 3145525 | 2010-01-24 03:04:27 +0000 | [diff] [blame] | 10 | // CHECK: @_ZL1x = internal global |
Douglas Gregor | da55074 | 2011-05-07 22:06:45 +0000 | [diff] [blame] | 11 | |
| 12 | struct X { |
| 13 | int (*fp)(int, int); |
| 14 | }; |
| 15 | |
| 16 | int add(int x, int y) { return x + y; } |
| 17 | |
| 18 | // CHECK: @x2 = constant |
| 19 | extern const X x2; |
| 20 | const X x2 = { &add }; |
Douglas Gregor | 2bb1101 | 2011-05-13 01:05:07 +0000 | [diff] [blame] | 21 | |
| 22 | struct X1 { |
| 23 | mutable int i; |
| 24 | }; |
| 25 | |
| 26 | struct X2 { |
| 27 | X1 array[3]; |
| 28 | }; |
| 29 | |
| 30 | // CHECK: @x2b = global |
| 31 | extern const X2 x2b; |
| 32 | const X2 x2b = { { { 1 }, { 2 }, { 3 } } }; |