Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / windows-itanium-dllexport.cpp
blobc09fa30d761af43896cde2de0a0e19c71f78ea27
1 // RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fdeclspec %s -o - | FileCheck %s --check-prefixes=CHECK,WI
2 // RUN: %clang_cc1 -emit-llvm -triple x86_64-scei-ps4 -fdeclspec %s -o - | FileCheck %s --check-prefixes=CHECK,PS4
3 // RUN: %clang_cc1 -emit-llvm -triple x86_64-sie-ps5 -fdeclspec %s -o - | FileCheck %s --check-prefixes=CHECK,PS4
5 #define JOIN2(x, y) x##y
6 #define JOIN(x, y) JOIN2(x, y)
7 #define UNIQ(name) JOIN(name, __LINE__)
8 #define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; }
10 struct __declspec(dllexport) s {
11 void f() {}
14 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1saSERKS_
15 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1s1fEv
17 template <class T>
18 class c {
19 void f() {}
22 template class __declspec(dllexport) c<int>;
24 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiEaSERKS0_
25 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv
27 extern template class c<char>;
28 template class __declspec(dllexport) c<char>;
30 // WI: define {{.*}} dllexport {{.*}} @_ZN1cIcEaSERKS0_
31 // WI: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
32 // PS4-NOT: @_ZN1cIcEaSERKS0_
33 // PS4: define weak_odr void @_ZN1cIcE1fEv
35 c<double> g;
36 template class __declspec(dllexport) c<double>;
38 // WI: define {{.*}} dllexport {{.*}} @_ZN1cIdEaSERKS0_
39 // WI: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv
40 // PS4-NOT: @_ZN1cIdEaSERKS0_
41 // PS4: define weak_odr void @_ZN1cIdE1fEv
43 template <class T>
44 struct outer {
45 void f() {}
46 struct inner {
47 void f() {}
51 template class __declspec(dllexport) outer<int>;
53 // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv
54 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv
56 extern template class __declspec(dllimport) outer<char>;
57 USEMEMFUNC(outer<char>, f)
58 USEMEMFUNC(outer<char>::inner, f)
60 // CHECK-DAG: declare dllimport {{.*}} @_ZN5outerIcE1fEv
61 // WI-DAG: define {{.*}} @_ZN5outerIcE5inner1fEv
62 // PS4-DAG: declare {{.*}} @_ZN5outerIcE5inner1fEv