Skip to content

Commit f2fe2ea

Browse files
mati865jeremyd2019
authored andcommitted
[Clang][Cygwin] Enable few conditions that are shared with MinGW
1 parent a175446 commit f2fe2ea

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

clang/lib/AST/RecordLayoutBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ void ItaniumRecordLayoutBuilder::LayoutField(const FieldDecl *D,
19461946
// silently there. For other targets that have ms_struct enabled
19471947
// (most probably via a pragma or attribute), trigger a diagnostic
19481948
// that defaults to an error.
1949-
if (!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
1949+
if (!Context.getTargetInfo().getTriple().isOSCygMing())
19501950
Diag(D->getLocation(), diag::warn_npot_ms_struct);
19511951
}
19521952
if (TypeSize > FieldAlign &&

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM,
16711671

16721672
const llvm::Triple &TT = CGM.getTriple();
16731673
const auto &CGOpts = CGM.getCodeGenOpts();
1674-
if (TT.isWindowsGNUEnvironment()) {
1674+
if (TT.isOSCygMing()) {
16751675
// In MinGW, variables without DLLImport can still be automatically
16761676
// imported from a DLL by the linker; don't mark variables that
16771677
// potentially could come from another DLL as DSO local.

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,7 +3749,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,
37493749
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
37503750

37513751
// Don't import the RTTI but emit it locally.
3752-
if (CGM.getTriple().isWindowsGNUEnvironment())
3752+
if (CGM.getTriple().isOSCygMing())
37533753
return false;
37543754

37553755
if (CGM.getVTables().isVTableExternal(RD)) {
@@ -4038,7 +4038,7 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
40384038
!CGM.getContext()
40394039
.getTargetInfo()
40404040
.getTriple()
4041-
.isWindowsGNUEnvironment())
4041+
.isOSCygMing())
40424042
return CGM.getVTableLinkage(RD);
40434043
}
40444044

clang/lib/CodeGen/Targets/X86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ class WinX86_64ABIInfo : public ABIInfo {
13741374
public:
13751375
WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT, X86AVXABILevel AVXLevel)
13761376
: ABIInfo(CGT), AVXLevel(AVXLevel),
1377-
IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
1377+
IsMingw64(getTarget().getTriple().isOSCygMing()) {}
13781378

13791379
void computeInfo(CGFunctionInfo &FI) const override;
13801380

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
749749
break;
750750
case ToolChain::FT_Shared:
751751
Suffix = TT.isOSWindows()
752-
? (TT.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
752+
? (TT.isOSCygMing() ? ".dll.a" : ".lib")
753753
: ".so";
754754
break;
755755
}

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12516,7 +12516,7 @@ static bool isDefaultStdCall(FunctionDecl *FD, Sema &S) {
1251612516

1251712517
// Default calling convention for MinGW is __cdecl
1251812518
const llvm::Triple &T = S.Context.getTargetInfo().getTriple();
12519-
if (T.isWindowsGNUEnvironment())
12519+
if (T.isOSCygMing())
1252012520
return false;
1252112521

1252212522
// Default calling convention for WinMain, wWinMain and DllMain

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,7 +6163,7 @@ static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) {
61636163
}
61646164
} MarkingDllexportedContext(S, Class, ClassAttr->getLocation());
61656165

6166-
if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
6166+
if (S.Context.getTargetInfo().getTriple().isOSCygMing())
61676167
S.MarkVTableUsed(Class->getLocation(), Class, true);
61686168

61696169
for (Decl *Member : Class->decls()) {
@@ -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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8936,7 +8936,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
89368936
// still okay to specialize it.
89378937
StripImplicitInstantiation(
89388938
PrevDecl,
8939-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment());
8939+
Context.getTargetInfo().getTriple().isOSCygMing());
89408940
return false;
89418941
}
89428942
// Fall through
@@ -9804,7 +9804,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
98049804
: TSK_ExplicitInstantiationDeclaration;
98059805

98069806
if (TSK == TSK_ExplicitInstantiationDeclaration &&
9807-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9807+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
98089808
// Check for dllexport class template instantiation declarations,
98099809
// except for MinGW mode.
98109810
for (const ParsedAttr &AL : Attr) {
@@ -9869,7 +9869,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
98699869
= PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;
98709870

98719871
if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr &&
9872-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9872+
Context.getTargetInfo().getTriple().isOSCygMing()) {
98739873
// Check for dllexport class template instantiation definitions in MinGW
98749874
// mode, if a previous declaration of the instantiation was seen.
98759875
for (const ParsedAttr &AL : Attr) {
@@ -10038,7 +10038,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
1003810038
// In MinGW mode, export the template instantiation if the declaration
1003910039
// was marked dllexport.
1004010040
if (PrevDecl_TSK == TSK_ExplicitInstantiationDeclaration &&
10041-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment() &&
10041+
Context.getTargetInfo().getTriple().isOSCygMing() &&
1004210042
PrevDecl->hasAttr<DLLExportAttr>()) {
1004310043
dllExportImportClassTemplateSpecialization(*this, Def);
1004410044
}

0 commit comments

Comments
 (0)