Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / mingw-template-dllexport.cpp
blob408a3fd0a77ddac051d6ae7e0710585a079cbe71
1 // RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s
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; }
8 template <class T>
9 class c {
10 void f() {}
13 template class __declspec(dllexport) c<int>;
15 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv
17 extern template class __declspec(dllexport) c<char>;
18 template class c<char>;
20 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIcE1fEv
22 extern template class c<double>;
23 template class __declspec(dllexport) c<double>;
25 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN1cIdE1fEv
27 template <class T>
28 struct outer {
29 void f();
30 struct inner {
31 void f();
35 template <class T> void outer<T>::f() {}
36 template <class T> void outer<T>::inner::f() {}
38 template class __declspec(dllexport) outer<int>;
40 // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv
41 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv
43 extern template class __declspec(dllimport) outer<char>;
44 USEMEMFUNC(outer<char>, f)
45 USEMEMFUNC(outer<char>::inner, f)
47 // CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv
48 // CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv