Skip to content

Commit b183a27

Browse files
kikairoyajeremyd2019
authored andcommitted
[Cygwin] Template instantiations should be exported by default (llvm#139799)
Behaves as same as both of Clang and GCC targetting MinGW. Required for compatibility for Cygwin-GCC. Divided from llvm#138773
1 parent 8011df6 commit b183a27

File tree

6 files changed

+81
-8
lines changed

6 files changed

+81
-8
lines changed

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6465,7 +6465,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
64656465
// declarations, except in MinGW mode.
64666466
if (ClassExported && !ClassAttr->isInherited() &&
64676467
TSK == TSK_ExplicitInstantiationDeclaration &&
6468-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
6468+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
64696469
Class->dropAttr<DLLExportAttr>();
64706470
return;
64716471
}

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8935,8 +8935,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
89358935
// The declaration itself has not actually been instantiated, so it is
89368936
// still okay to specialize it.
89378937
StripImplicitInstantiation(
8938-
PrevDecl,
8939-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment());
8938+
PrevDecl, Context.getTargetInfo().getTriple().isOSCygMing());
89408939
return false;
89418940
}
89428941
// Fall through
@@ -9804,7 +9803,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
98049803
: TSK_ExplicitInstantiationDeclaration;
98059804

98069805
if (TSK == TSK_ExplicitInstantiationDeclaration &&
9807-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9806+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
98089807
// Check for dllexport class template instantiation declarations,
98099808
// except for MinGW mode.
98109809
for (const ParsedAttr &AL : Attr) {
@@ -9869,7 +9868,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
98699868
= PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;
98709869

98719870
if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr &&
9872-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9871+
Context.getTargetInfo().getTriple().isOSCygMing()) {
98739872
// Check for dllexport class template instantiation definitions in MinGW
98749873
// mode, if a previous declaration of the instantiation was seen.
98759874
for (const ParsedAttr &AL : Attr) {
@@ -10038,7 +10037,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
1003810037
// In MinGW mode, export the template instantiation if the declaration
1003910038
// was marked dllexport.
1004010039
if (PrevDecl_TSK == TSK_ExplicitInstantiationDeclaration &&
10041-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment() &&
10040+
Context.getTargetInfo().getTriple().isOSCygMing() &&
1004210041
PrevDecl->hasAttr<DLLExportAttr>()) {
1004310042
dllExportImportClassTemplateSpecialization(*this, Def);
1004410043
}

0 commit comments

Comments
 (0)