summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-04-26 08:09:51 +0000
committerMartin Storsjo <martin@martin.st>2019-04-26 08:09:51 +0000
commit5be69bc68a6581897d7fa5068059aa8e723c6ce7 (patch)
treebc7a1b7ace9d742554d2656c863e35e5c5627e8d /clang/lib/Sema/SemaDeclCXX.cpp
parentc316b22496017c48aba08de1fb69554404bc311b (diff)
downloadbcm5719-llvm-5be69bc68a6581897d7fa5068059aa8e723c6ce7.tar.gz
bcm5719-llvm-5be69bc68a6581897d7fa5068059aa8e723c6ce7.zip
[MinGW] Fix dllexport of explicit template instantiation
Contrary to MSVC, GCC/MinGW needs to have the dllexport attribute on the template instantiation declaration, not on the definition. Previously clang never marked explicit template instantiations as dllexport in MinGW mode, if the instantiation had a previous declaration, regardless of where the attribute was placed. This makes Clang behave like GCC in this regard, and allows using the same attribute form for both MinGW compilers. This fixes PR40256. Differential Revision: https://reviews.llvm.org/D61118 llvm-svn: 359285
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 797bbbeca95..c03bcb5e3a5 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5697,9 +5697,11 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
TemplateSpecializationKind TSK = Class->getTemplateSpecializationKind();
- // Ignore explicit dllexport on explicit class template instantiation declarations.
+ // Ignore explicit dllexport on explicit class template instantiation
+ // declarations, except in MinGW mode.
if (ClassExported && !ClassAttr->isInherited() &&
- TSK == TSK_ExplicitInstantiationDeclaration) {
+ TSK == TSK_ExplicitInstantiationDeclaration &&
+ !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
Class->dropAttr<DLLExportAttr>();
return;
}
OpenPOWER on IntegriCloud