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-pc-win32 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSVCCOMPAT
9 // NORMAL-NOT: define{{.*}} void @_ZN1A1fEv
10 // MSVCCOMPAT-NOT: define{{.*}} void @"?f@A@@QEAAXXZ"
13 template<typename
> struct B
{ };
15 template<> struct B
<char> {
19 // NORMAL-NOT: _ZN1BIcE1fEv
20 // MSVCCOMPAT-NOT: @"?f@?$B@D@@QEAAXXZ"
23 // We need a final CHECK line here.
25 // NORMAL-LABEL: define{{.*}} void @_Z1fv
26 // MSVCCOMPAT-LABEL: define dso_local void @"?f@@YAXXZ"
29 // <rdar://problem/8740363>
32 // NORMAL-LABEL: define linkonce_odr void @_Z2f1i
33 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?f1@@YAXH@Z"
36 void test_f1() { f1(17); }
40 template <typename T
> class ClassTemplate
{
42 friend void T::func();
46 // NORMAL-LABEL: define linkonce_odr void @_ZN5test11C4funcEv(
47 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?func@C@test1@@QEAAXXZ"(
68 friend void f(const A
& a
) { }
74 // NORMAL-LABEL: define linkonce_odr void @_ZN5test21fERKNS_1AE
75 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?f@test2@@YAXAEBUA@1@@Z"
78 // NORMAL-NOT: _Z17ExternAndInlineFnv
79 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?ExternAndInlineFn@@YAXXZ"
80 extern inline void ExternAndInlineFn() {}
82 // NORMAL-NOT: _Z18InlineThenExternFnv
83 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?InlineThenExternFn@@YAXXZ"
84 inline void InlineThenExternFn() {}
85 extern void InlineThenExternFn();
87 // NORMAL-LABEL: define{{.*}} void @_Z18ExternThenInlineFnv
88 // MSVCCOMPAT-LABEL: define dso_local void @"?ExternThenInlineFn@@YAXXZ"
89 extern void ExternThenInlineFn() {}
91 // NORMAL-NOT: _Z25ExternThenInlineThenDefFnv
92 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?ExternThenInlineThenDefFn@@YAXXZ"
93 extern void ExternThenInlineThenDefFn();
94 inline void ExternThenInlineThenDefFn();
95 void ExternThenInlineThenDefFn() {}
97 // NORMAL-NOT: _Z25InlineThenExternThenDefFnv
98 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?InlineThenExternThenDefFn@@YAXXZ"
99 inline void InlineThenExternThenDefFn();
100 extern void InlineThenExternThenDefFn();
101 void InlineThenExternThenDefFn() {}
103 // NORMAL-NOT: _Z17ExternAndConstexprFnv
104 // MSVCCOMPAT-LABEL: define weak_odr dso_local noundef i32 @"?ExternAndConstexprFn@@YAHXZ"
105 extern constexpr int ExternAndConstexprFn() { return 0; }
107 // NORMAL-NOT: _Z11ConstexprFnv
108 // MSVCCOMPAT-NOT: @"?ConstexprFn@@YAHXZ"
109 constexpr int ConstexprFn() { return 0; }
111 template <typename T
>
112 extern inline void ExternInlineOnPrimaryTemplate(T
);
114 // NORMAL-LABEL: define{{.*}} void @_Z29ExternInlineOnPrimaryTemplateIiEvT_
115 // MSVCCOMPAT-LABEL: define dso_local void @"??$ExternInlineOnPrimaryTemplate@H@@YAXH@Z"
117 void ExternInlineOnPrimaryTemplate(int) {}
119 template <typename T
>
120 extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(T
);
122 // NORMAL-NOT: _Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_
123 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"??$ExternInlineOnPrimaryTemplateAndSpecialization@H@@YAXH@Z"
125 extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(int) {}
127 struct TypeWithInlineMethods
{
128 // NORMAL-NOT: _ZN21TypeWithInlineMethods9StaticFunEv
129 // MSVCCOMPAT-NOT: @"?StaticFun@TypeWithInlineMethods@@SAXXZ"
130 static void StaticFun() {}
131 // NORMAL-NOT: _ZN21TypeWithInlineMethods12NonStaticFunEv
132 // MSVCCOMPAT-NOT: @"?NonStaticFun@TypeWithInlineMethods@@QEAAXXZ"
133 void NonStaticFun() { StaticFun(); }
147 __attribute__((used
)) inline S
<int> Foo() { return S
<int>(); }
148 // NORMAL-LABEL: define linkonce_odr void @_ZN7PR229593FooEv(
149 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local i8 @"?Foo@PR22959@@YA?AU?$S@H@1@XZ"(