summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/dllexport.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-08-21 01:14:01 +0000
committerHans Wennborg <hans@hanshq.net>2014-08-21 01:14:01 +0000
commit334e4ffc0d4e52498b2fd304981f1cbc3ca32554 (patch)
tree37c1c48fa4256f9de82e49b1ffd836d1e99cdc6e /clang/test/CodeGenCXX/dllexport.cpp
parent689623009b8792bb09416686f2b1d21f4f0d6ddf (diff)
downloadbcm5719-llvm-334e4ffc0d4e52498b2fd304981f1cbc3ca32554.tar.gz
bcm5719-llvm-334e4ffc0d4e52498b2fd304981f1cbc3ca32554.zip
MS ABI: Don't always instantiate all members of dllexported class templates (PR20163)
Normally we mark all members of exported classes referenced to get them emitted. However, MSVC doesn't do this for class templates that are implicitly specialized or just have an explicit instantiation declaration. For such specializations, the members are emitted when referenced. The exception is the case when the dllexport attribute is propagated from a base class to a base class template that doesn't have an explicit attribute: in this case all methods of the base class template do get instantiated. llvm-svn: 216145
Diffstat (limited to 'clang/test/CodeGenCXX/dllexport.cpp')
-rw-r--r--clang/test/CodeGenCXX/dllexport.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp
index 846978dbb19..4cf6005134c 100644
--- a/clang/test/CodeGenCXX/dllexport.cpp
+++ b/clang/test/CodeGenCXX/dllexport.cpp
@@ -509,11 +509,9 @@ USEVAR(T::b)
int T::c;
template <typename T> struct __declspec(dllexport) U { void foo() {} };
-// The U<int> specialization below must cause the following to be emitted:
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?foo@?$U@H@@QAEXXZ"
-// M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.U* @"\01??4?$U@H@@QAEAAU0@ABU0@@Z"
struct __declspec(dllexport) V : public U<int> { };
-
+// U<int>'s assignment operator is emitted.
+// M32-DAG: define weak_odr dllexport x86_thiscallcc dereferenceable({{[0-9]+}}) %struct.U* @"\01??4?$U@H@@QAEAAU0@ABU0@@Z"
struct __declspec(dllexport) W { virtual void foo() {} };
// Default ctor:
@@ -618,6 +616,7 @@ USEMEMFUNC(DerivedFromTemplate, func)
// ExportedTemplate is explicitly exported.
struct __declspec(dllexport) DerivedFromExportedTemplate : public ExportedClassTemplate<int> {};
+USEMEMFUNC(DerivedFromExportedTemplate, func)
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExportedClassTemplate@H@@QAEXXZ"
// G32-DAG: define weak_odr dllexport x86_thiscallcc void @_ZN21ExportedClassTemplateIiE4funcEv
OpenPOWER on IntegriCloud