Saleem Abdulrasool | 8bbc315 | 2016-10-14 22:25:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - | FileCheck %s |
| 2 | |
Shoaib Meenai | a904745 | 2017-04-20 01:11:42 +0000 | [diff] [blame] | 3 | #define JOIN2(x, y) x##y |
| 4 | #define JOIN(x, y) JOIN2(x, y) |
| 5 | #define UNIQ(name) JOIN(name, __LINE__) |
| 6 | #define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; } |
| 7 | |
Saleem Abdulrasool | 8bbc315 | 2016-10-14 22:25:46 +0000 | [diff] [blame] | 8 | struct __declspec(dllexport) s { |
| 9 | void f() {} |
| 10 | }; |
| 11 | |
| 12 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_ |
| 13 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv |
| 14 | |
Shoaib Meenai | ab3f96c | 2016-11-09 23:52:20 +0000 | [diff] [blame] | 15 | template <class T> |
| 16 | class c { |
| 17 | void f() {} |
| 18 | }; |
| 19 | |
| 20 | template class __declspec(dllexport) c<int>; |
| 21 | |
| 22 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiEaSERKS0_ |
| 23 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv |
| 24 | |
| 25 | extern template class c<char>; |
| 26 | template class __declspec(dllexport) c<char>; |
| 27 | |
| 28 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_ |
| 29 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv |
| 30 | |
Shoaib Meenai | fc78d7c | 2016-12-05 18:01:35 +0000 | [diff] [blame] | 31 | c<double> g; |
| 32 | template class __declspec(dllexport) c<double>; |
| 33 | |
| 34 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdEaSERKS0_ |
| 35 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv |
Shoaib Meenai | a904745 | 2017-04-20 01:11:42 +0000 | [diff] [blame] | 36 | |
| 37 | template <class T> |
| 38 | struct outer { |
| 39 | void f() {} |
| 40 | struct inner { |
| 41 | void f() {} |
| 42 | }; |
| 43 | }; |
| 44 | |
| 45 | template class __declspec(dllexport) outer<int>; |
| 46 | |
| 47 | // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv |
| 48 | // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv |
| 49 | |
| 50 | extern template class __declspec(dllimport) outer<char>; |
| 51 | USEMEMFUNC(outer<char>, f) |
| 52 | USEMEMFUNC(outer<char>::inner, f) |
| 53 | |
| 54 | // CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv |
| 55 | // CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv |