2020-11-30 19:50:45 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - | FileCheck %s --check-prefixes=CHECK,WI
|
|
|
|
// RUN: %clang_cc1 -emit-llvm -triple x86_64-scei-ps4 -fdeclspec %s -o - | FileCheck %s --check-prefixes=CHECK,PS4
|
2016-10-15 06:25:46 +08:00
|
|
|
|
2017-04-20 09:11:42 +08:00
|
|
|
#define JOIN2(x, y) x##y
|
|
|
|
#define JOIN(x, y) JOIN2(x, y)
|
|
|
|
#define UNIQ(name) JOIN(name, __LINE__)
|
|
|
|
#define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; }
|
|
|
|
|
2016-10-15 06:25:46 +08:00
|
|
|
struct __declspec(dllexport) s {
|
|
|
|
void f() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
|
|
|
|
|
2016-11-10 07:52:20 +08:00
|
|
|
template <class T>
|
|
|
|
class c {
|
|
|
|
void f() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
template class __declspec(dllexport) c<int>;
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiEaSERKS0_
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv
|
|
|
|
|
|
|
|
extern template class c<char>;
|
|
|
|
template class __declspec(dllexport) c<char>;
|
|
|
|
|
2020-11-30 19:50:45 +08:00
|
|
|
// WI: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_
|
|
|
|
// WI: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
|
|
|
|
// PS4-NOT: @_ZN1cIcEaSERKS0_
|
|
|
|
// PS4: define weak_odr void @_ZN1cIcE1fEv
|
2016-11-10 07:52:20 +08:00
|
|
|
|
2016-12-06 02:01:35 +08:00
|
|
|
c<double> g;
|
|
|
|
template class __declspec(dllexport) c<double>;
|
|
|
|
|
2020-11-30 19:50:45 +08:00
|
|
|
// WI: define {{.*}} dllexport {{.*}} @_ZN1cIdEaSERKS0_
|
|
|
|
// WI: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv
|
|
|
|
// PS4-NOT: @_ZN1cIdEaSERKS0_
|
|
|
|
// PS4: define weak_odr void @_ZN1cIdE1fEv
|
2017-04-20 09:11:42 +08:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
struct outer {
|
|
|
|
void f() {}
|
|
|
|
struct inner {
|
|
|
|
void f() {}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
template class __declspec(dllexport) outer<int>;
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv
|
|
|
|
// CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv
|
|
|
|
|
|
|
|
extern template class __declspec(dllimport) outer<char>;
|
|
|
|
USEMEMFUNC(outer<char>, f)
|
|
|
|
USEMEMFUNC(outer<char>::inner, f)
|
|
|
|
|
2020-11-30 19:50:45 +08:00
|
|
|
// CHECK-DAG: declare dllimport {{.*}} @_ZN5outerIcE1fEv
|
|
|
|
// WI-DAG: define {{.*}} @_ZN5outerIcE5inner1fEv
|
|
|
|
// PS4-DAG: declare {{.*}} @_ZN5outerIcE5inner1fEv
|