diff options
author | Martin Storsjo <martin@martin.st> | 2019-04-26 08:09:51 +0000 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2019-04-26 08:09:51 +0000 |
commit | 5be69bc68a6581897d7fa5068059aa8e723c6ce7 (patch) | |
tree | bc7a1b7ace9d742554d2656c863e35e5c5627e8d /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | c316b22496017c48aba08de1fb69554404bc311b (diff) | |
download | bcm5719-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.cpp | 6 |
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; } |