Skip to content

[Cygwin] Template instantiations should be exported by default #139799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6576,7 +6576,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
// declarations, except in MinGW mode.
if (ClassExported && !ClassAttr->isInherited() &&
TSK == TSK_ExplicitInstantiationDeclaration &&
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
!Context.getTargetInfo().getTriple().isOSCygMing()) {
Class->dropAttr<DLLExportAttr>();
return;
}
Expand Down
9 changes: 4 additions & 5 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8987,8 +8987,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
// The declaration itself has not actually been instantiated, so it is
// still okay to specialize it.
StripImplicitInstantiation(
PrevDecl,
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment());
PrevDecl, Context.getTargetInfo().getTriple().isOSCygMing());
return false;
}
// Fall through
Expand Down Expand Up @@ -9855,7 +9854,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
: TSK_ExplicitInstantiationDeclaration;

if (TSK == TSK_ExplicitInstantiationDeclaration &&
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
!Context.getTargetInfo().getTriple().isOSCygMing()) {
// Check for dllexport class template instantiation declarations,
// except for MinGW mode.
for (const ParsedAttr &AL : Attr) {
Expand Down Expand Up @@ -9920,7 +9919,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
= PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;

if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr &&
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
Context.getTargetInfo().getTriple().isOSCygMing()) {
// Check for dllexport class template instantiation definitions in MinGW
// mode, if a previous declaration of the instantiation was seen.
for (const ParsedAttr &AL : Attr) {
Expand Down Expand Up @@ -10088,7 +10087,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
// In MinGW mode, export the template instantiation if the declaration
// was marked dllexport.
if (PrevDecl_TSK == TSK_ExplicitInstantiationDeclaration &&
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment() &&
Context.getTargetInfo().getTriple().isOSCygMing() &&
PrevDecl->hasAttr<DLLExportAttr>()) {
dllExportImportClassTemplateSpecialization(*this, Def);
}
Expand Down
Loading