diff options
Diffstat (limited to 'clang/test/CodeGenCXX')
| -rw-r--r-- | clang/test/CodeGenCXX/dllexport.cpp | 12 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/dllimport.cpp | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp index 392df84da10..16cfb846584 100644 --- a/clang/test/CodeGenCXX/dllexport.cpp +++ b/clang/test/CodeGenCXX/dllexport.cpp @@ -1012,6 +1012,18 @@ struct __declspec(dllexport) LayerTreeImpl { // M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc %"struct.LayerTreeImpl::ElementLayers"* @"??0ElementLayers@LayerTreeImpl@@QAE@XZ" // M64-DAG: define weak_odr dso_local dllexport %"struct.LayerTreeImpl::ElementLayers"* @"??0ElementLayers@LayerTreeImpl@@QEAA@XZ" +namespace pr39496 { +// Make sure dll attribute are inherited by static locals also in template +// specializations. +template <typename> struct __declspec(dllexport) S { int foo() { static int x; return x++; } }; +int foo() { S<int> s; return s.foo(); } +// MSC-DAG: @"?x@?{{1|2}}??foo@?$S@H@pr39496@@Q{{[A-Z]*}}HXZ@4HA" = weak_odr dso_local dllexport global i32 0, comdat, align 4 + +template <typename> struct T { int foo() { static int x; return x++; } }; +template struct __declspec(dllexport) T<int>; +// MSC-DAG: @"?x@?{{1|2}}??foo@?$T@H@pr39496@@Q{{[A-Z]*}}HXZ@4HA" = weak_odr dso_local dllexport global i32 0, comdat, align 4 +} + class __declspec(dllexport) ACE_Shared_Object { public: virtual ~ACE_Shared_Object(); diff --git a/clang/test/CodeGenCXX/dllimport.cpp b/clang/test/CodeGenCXX/dllimport.cpp index a6345be9adf..874f119a43c 100644 --- a/clang/test/CodeGenCXX/dllimport.cpp +++ b/clang/test/CodeGenCXX/dllimport.cpp @@ -996,3 +996,16 @@ template struct __declspec(dllexport) ExplicitInstantiationDeclTemplateBase2<int USEMEMFUNC(ExplicitInstantiationDeclTemplateBase2<int>, func) // M32-DAG: declare dllimport x86_thiscallcc void @"?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ" // G32-DAG: define weak_odr dso_local x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv + +namespace pr39496 { +// Make sure dll attribute are inherited by static locals also in template +// specializations. +template <typename> struct __declspec(dllimport) S { int foo() { static int x; return x++; } }; +int foo() { S<int> s; return s.foo(); } +// MO1-DAG: @"?x@?{{1|2}}??foo@?$S@H@pr39496@@Q{{[A-Z]*}}HXZ@4HA" = available_externally dllimport global i32 0, align 4 + +template <typename> struct T { int foo() { static int x; return x++; } }; +extern template struct __declspec(dllimport) T<int>; +int bar() { T<int> t; return t.foo(); } +// MO1-DAG: @"?x@?{{1|2}}??foo@?$T@H@pr39496@@Q{{[A-Z]*}}HXZ@4HA" = available_externally dllimport global i32 0, align 4 +} |

