windows-itanium-dllexport.cpp
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - | FileCheck %s
#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; }
struct __declspec(dllexport) s {
void f() {}
};
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
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>;
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
c<double> g;
template class __declspec(dllexport) c<double>;
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdEaSERKS0_
// CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv
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)
// CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv
// CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv