1// RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NORMAL 2// RUN: %clang_cc1 %s -std=c++11 -fms-compatibility -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSVCCOMPAT 3// CHECK: ; ModuleID 4 5struct A { 6 inline void f(); 7}; 8 9// CHECK-NOT: define void @_ZN1A1fEv 10void A::f() { } 11 12template<typename> struct B { }; 13 14template<> struct B<char> { 15 inline void f(); 16}; 17 18// CHECK-NOT: _ZN1BIcE1fEv 19void B<char>::f() { } 20 21// We need a final CHECK line here. 22 23// CHECK-LABEL: define void @_Z1fv 24void f() { } 25 26// <rdar://problem/8740363> 27inline void f1(int); 28 29// CHECK-LABEL: define linkonce_odr void @_Z2f1i 30void f1(int) { } 31 32void test_f1() { f1(17); } 33 34// PR8789 35namespace test1 { 36 template <typename T> class ClassTemplate { 37 private: 38 friend void T::func(); 39 void g() {} 40 }; 41 42 // CHECK-LABEL: define linkonce_odr void @_ZN5test11C4funcEv( 43 44 class C { 45 public: 46 void func() { 47 ClassTemplate<C> ct; 48 ct.g(); 49 } 50 }; 51 52 void f() { 53 C c; 54 c.func(); 55 } 56} 57 58// PR13252 59namespace test2 { 60 struct A; 61 void f(const A& a); 62 struct A { 63 friend void f(const A& a) { } 64 }; 65 void g() { 66 A a; 67 f(a); 68 } 69 // CHECK-LABEL: define linkonce_odr void @_ZN5test21fERKNS_1AE 70} 71 72// MSVCCOMPAT-LABEL: define weak_odr void @_Z17ExternAndInlineFnv 73// NORMAL-NOT: _Z17ExternAndInlineFnv 74extern inline void ExternAndInlineFn() {} 75 76// MSVCCOMPAT-LABEL: define weak_odr void @_Z18InlineThenExternFnv 77// NORMAL-NOT: _Z18InlineThenExternFnv 78inline void InlineThenExternFn() {} 79extern void InlineThenExternFn(); 80 81// CHECK-LABEL: define void @_Z18ExternThenInlineFnv 82extern void ExternThenInlineFn() {} 83 84// MSVCCOMPAT-LABEL: define weak_odr void @_Z25ExternThenInlineThenDefFnv 85// NORMAL-NOT: _Z25ExternThenInlineThenDefFnv 86extern void ExternThenInlineThenDefFn(); 87inline void ExternThenInlineThenDefFn(); 88void ExternThenInlineThenDefFn() {} 89 90// MSVCCOMPAT-LABEL: define weak_odr void @_Z25InlineThenExternThenDefFnv 91// NORMAL-NOT: _Z25InlineThenExternThenDefFnv 92inline void InlineThenExternThenDefFn(); 93extern void InlineThenExternThenDefFn(); 94void InlineThenExternThenDefFn() {} 95 96// MSVCCOMPAT-LABEL: define weak_odr i32 @_Z20ExternAndConstexprFnv 97// NORMAL-NOT: _Z17ExternAndConstexprFnv 98extern constexpr int ExternAndConstexprFn() { return 0; } 99 100// CHECK-NOT: _Z11ConstexprFnv 101constexpr int ConstexprFn() { return 0; } 102 103template <typename T> 104extern inline void ExternInlineOnPrimaryTemplate(T); 105 106// CHECK-LABEL: define void @_Z29ExternInlineOnPrimaryTemplateIiEvT_ 107template <> 108void ExternInlineOnPrimaryTemplate(int) {} 109 110template <typename T> 111extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(T); 112 113// MSVCCOMPAT-LABEL: define weak_odr void @_Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_ 114// NORMAL-NOT: _Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_ 115template <> 116extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(int) {} 117 118struct TypeWithInlineMethods { 119 // CHECK-NOT: _ZN21TypeWithInlineMethods9StaticFunEv 120 static void StaticFun() {} 121 // CHECK-NOT: _ZN21TypeWithInlineMethods12NonStaticFunEv 122 void NonStaticFun() { StaticFun(); } 123}; 124