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"
31 // NORMAL-LABEL: define linkonce_odr void @_Z2f1i
32 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?f1@@YAXH@Z"
35 void test_f1() { f1(17); }
39 template <typename T
> class ClassTemplate
{
41 friend void T::func();
45 // NORMAL-LABEL: define linkonce_odr void @_ZN5test11C4funcEv(
46 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?func@C@test1@@QEAAXXZ"(
67 friend void f(const A
& a
) { }
73 // NORMAL-LABEL: define linkonce_odr void @_ZN5test21fERKNS_1AE
74 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local void @"?f@test2@@YAXAEBUA@1@@Z"
77 // NORMAL-NOT: _Z17ExternAndInlineFnv
78 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?ExternAndInlineFn@@YAXXZ"
79 extern inline void ExternAndInlineFn() {}
81 // NORMAL-NOT: _Z18InlineThenExternFnv
82 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?InlineThenExternFn@@YAXXZ"
83 inline void InlineThenExternFn() {}
84 extern void InlineThenExternFn();
86 // NORMAL-LABEL: define{{.*}} void @_Z18ExternThenInlineFnv
87 // MSVCCOMPAT-LABEL: define dso_local void @"?ExternThenInlineFn@@YAXXZ"
88 extern void ExternThenInlineFn() {}
90 // NORMAL-NOT: _Z25ExternThenInlineThenDefFnv
91 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?ExternThenInlineThenDefFn@@YAXXZ"
92 extern void ExternThenInlineThenDefFn();
93 inline void ExternThenInlineThenDefFn();
94 void ExternThenInlineThenDefFn() {}
96 // NORMAL-NOT: _Z25InlineThenExternThenDefFnv
97 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"?InlineThenExternThenDefFn@@YAXXZ"
98 inline void InlineThenExternThenDefFn();
99 extern void InlineThenExternThenDefFn();
100 void InlineThenExternThenDefFn() {}
102 // NORMAL-NOT: _Z17ExternAndConstexprFnv
103 // MSVCCOMPAT-LABEL: define weak_odr dso_local noundef i32 @"?ExternAndConstexprFn@@YAHXZ"
104 extern constexpr int ExternAndConstexprFn() { return 0; }
106 // NORMAL-NOT: _Z11ConstexprFnv
107 // MSVCCOMPAT-NOT: @"?ConstexprFn@@YAHXZ"
108 constexpr int ConstexprFn() { return 0; }
110 template <typename T
>
111 extern inline void ExternInlineOnPrimaryTemplate(T
);
113 // NORMAL-LABEL: define{{.*}} void @_Z29ExternInlineOnPrimaryTemplateIiEvT_
114 // MSVCCOMPAT-LABEL: define dso_local void @"??$ExternInlineOnPrimaryTemplate@H@@YAXH@Z"
116 void ExternInlineOnPrimaryTemplate(int) {}
118 template <typename T
>
119 extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(T
);
121 // NORMAL-NOT: _Z46ExternInlineOnPrimaryTemplateAndSpecializationIiEvT_
122 // MSVCCOMPAT-LABEL: define weak_odr dso_local void @"??$ExternInlineOnPrimaryTemplateAndSpecialization@H@@YAXH@Z"
124 extern inline void ExternInlineOnPrimaryTemplateAndSpecialization(int) {}
126 struct TypeWithInlineMethods
{
127 // NORMAL-NOT: _ZN21TypeWithInlineMethods9StaticFunEv
128 // MSVCCOMPAT-NOT: @"?StaticFun@TypeWithInlineMethods@@SAXXZ"
129 static void StaticFun() {}
130 // NORMAL-NOT: _ZN21TypeWithInlineMethods12NonStaticFunEv
131 // MSVCCOMPAT-NOT: @"?NonStaticFun@TypeWithInlineMethods@@QEAAXXZ"
132 void NonStaticFun() { StaticFun(); }
146 __attribute__((used
)) inline S
<int> Foo() { return S
<int>(); }
147 // NORMAL-LABEL: define linkonce_odr void @_ZN7PR229593FooEv(
148 // MSVCCOMPAT-LABEL: define linkonce_odr dso_local i8 @"?Foo@PR22959@@YA?AU?$S@H@1@XZ"(