Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
Anders Carlsson | 48eda2c | 2009-12-04 22:35:50 +0000 | [diff] [blame] | 2 | // CHECK: ; ModuleID |
| 3 | |
| 4 | struct A { |
| 5 | inline void f(); |
| 6 | }; |
| 7 | |
| 8 | // CHECK-NOT: define void @_ZN1A1fEv |
| 9 | void A::f() { } |
| 10 | |
| 11 | template<typename> struct B { }; |
| 12 | |
| 13 | template<> struct B<char> { |
| 14 | inline void f(); |
| 15 | }; |
| 16 | |
| 17 | // CHECK-NOT: _ZN1BIcE1fEv |
| 18 | void B<char>::f() { } |
| 19 | |
| 20 | // We need a final CHECK line here. |
| 21 | |
| 22 | // CHECK: define void @_Z1fv |
| 23 | void f() { } |
Douglas Gregor | 8f15094 | 2010-12-09 16:59:22 +0000 | [diff] [blame] | 24 | |
| 25 | // <rdar://problem/8740363> |
| 26 | inline void f1(int); |
| 27 | |
| 28 | // CHECK: define linkonce_odr void @_Z2f1i |
| 29 | void f1(int) { } |
| 30 | |
| 31 | void test_f1() { f1(17); } |
John McCall | bfdcdc8 | 2010-12-15 04:00:32 +0000 | [diff] [blame] | 32 | |
| 33 | // PR8789 |
| 34 | namespace test1 { |
| 35 | template <typename T> class ClassTemplate { |
| 36 | private: |
| 37 | friend void T::func(); |
| 38 | void g() {} |
| 39 | }; |
| 40 | |
| 41 | // CHECK: define linkonce_odr void @_ZN5test11C4funcEv( |
| 42 | |
| 43 | class C { |
| 44 | public: |
| 45 | void func() { |
| 46 | ClassTemplate<C> ct; |
| 47 | ct.g(); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | void f() { |
| 52 | C c; |
| 53 | c.func(); |
| 54 | } |
| 55 | } |
Eli Friedman | b135f0f | 2012-07-02 21:05:30 +0000 | [diff] [blame] | 56 | |
| 57 | // PR13252 |
| 58 | namespace test2 { |
| 59 | struct A; |
| 60 | void f(const A& a); |
| 61 | struct A { |
| 62 | friend void f(const A& a) { } |
| 63 | }; |
| 64 | void g() { |
| 65 | A a; |
| 66 | f(a); |
| 67 | } |
| 68 | // CHECK: define linkonce_odr void @_ZN5test21fERKNS_1AE |
| 69 | } |