Skip to content

Commit 7f22b8f

Browse files
committed
[Clang][Cygwin] Enable few conditions that are shared with MinGW
1 parent 0f696c2 commit 7f22b8f

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

clang/lib/AST/ItaniumCXXABI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class ItaniumCXXABI : public CXXABI {
236236

237237
CallingConv getDefaultMethodCallConv(bool isVariadic) const override {
238238
const llvm::Triple &T = Context.getTargetInfo().getTriple();
239-
if (!isVariadic && T.isWindowsGNUEnvironment() &&
239+
if (!isVariadic && T.isOSCygMing() &&
240240
T.getArch() == llvm::Triple::x86)
241241
return CC_X86ThisCall;
242242
return Context.getTargetInfo().getDefaultCallingConv();

clang/lib/AST/RecordLayoutBuilder.cpp

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

clang/lib/CodeGen/CodeGenModule.cpp

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

16811681
const llvm::Triple &TT = CGM.getTriple();
16821682
const auto &CGOpts = CGM.getCodeGenOpts();
1683-
if (TT.isWindowsGNUEnvironment()) {
1683+
if (TT.isOSCygMing()) {
16841684
// In MinGW, variables without DLLImport can still be automatically
16851685
// imported from a DLL by the linker; don't mark variables that
16861686
// 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
@@ -3757,7 +3757,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,
37573757
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
37583758

37593759
// Don't import the RTTI but emit it locally.
3760-
if (CGM.getTriple().isWindowsGNUEnvironment())
3760+
if (CGM.getTriple().isOSCygMing())
37613761
return false;
37623762

37633763
if (CGM.getVTables().isVTableExternal(RD)) {
@@ -4047,7 +4047,7 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
40474047
!CGM.getContext()
40484048
.getTargetInfo()
40494049
.getTriple()
4050-
.isWindowsGNUEnvironment())
4050+
.isOSCygMing())
40514051
return CGM.getVTableLinkage(RD);
40524052
}
40534053

clang/lib/CodeGen/Targets/X86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ class WinX86_64ABIInfo : public ABIInfo {
13911391
public:
13921392
WinX86_64ABIInfo(CodeGen::CodeGenTypes &CGT, X86AVXABILevel AVXLevel)
13931393
: ABIInfo(CGT), AVXLevel(AVXLevel),
1394-
IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
1394+
IsMingw64(getTarget().getTriple().isOSCygMing()) {}
13951395

13961396
void computeInfo(CGFunctionInfo &FI) const override;
13971397

clang/lib/Driver/ToolChain.cpp

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

clang/lib/Sema/SemaDecl.cpp

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

1253712537
// Default calling convention for MinGW is __cdecl
1253812538
const llvm::Triple &T = S.Context.getTargetInfo().getTriple();
12539-
if (T.isWindowsGNUEnvironment())
12539+
if (T.isOSCygMing())
1254012540
return false;
1254112541

1254212542
// 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
@@ -6272,7 +6272,7 @@ static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) {
62726272
}
62736273
} MarkingDllexportedContext(S, Class, ClassAttr->getLocation());
62746274

6275-
if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
6275+
if (S.Context.getTargetInfo().getTriple().isOSCygMing())
62766276
S.MarkVTableUsed(Class->getLocation(), Class, true);
62776277

62786278
for (Decl *Member : Class->decls()) {
@@ -6574,7 +6574,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
65746574
// declarations, except in MinGW mode.
65756575
if (ClassExported && !ClassAttr->isInherited() &&
65766576
TSK == TSK_ExplicitInstantiationDeclaration &&
6577-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
6577+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
65786578
Class->dropAttr<DLLExportAttr>();
65796579
return;
65806580
}

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8890,7 +8890,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc,
88908890
// still okay to specialize it.
88918891
StripImplicitInstantiation(
88928892
PrevDecl,
8893-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment());
8893+
Context.getTargetInfo().getTriple().isOSCygMing());
88948894
return false;
88958895
}
88968896
// Fall through
@@ -9758,7 +9758,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
97589758
: TSK_ExplicitInstantiationDeclaration;
97599759

97609760
if (TSK == TSK_ExplicitInstantiationDeclaration &&
9761-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9761+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
97629762
// Check for dllexport class template instantiation declarations,
97639763
// except for MinGW mode.
97649764
for (const ParsedAttr &AL : Attr) {
@@ -9823,7 +9823,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
98239823
= PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;
98249824

98259825
if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr &&
9826-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
9826+
Context.getTargetInfo().getTriple().isOSCygMing()) {
98279827
// Check for dllexport class template instantiation definitions in MinGW
98289828
// mode, if a previous declaration of the instantiation was seen.
98299829
for (const ParsedAttr &AL : Attr) {
@@ -9991,7 +9991,7 @@ DeclResult Sema::ActOnExplicitInstantiation(
99919991
// In MinGW mode, export the template instantiation if the declaration
99929992
// was marked dllexport.
99939993
if (PrevDecl_TSK == TSK_ExplicitInstantiationDeclaration &&
9994-
Context.getTargetInfo().getTriple().isWindowsGNUEnvironment() &&
9994+
Context.getTargetInfo().getTriple().isOSCygMing() &&
99959995
PrevDecl->hasAttr<DLLExportAttr>()) {
99969996
dllExportImportClassTemplateSpecialization(*this, Def);
99979997
}

0 commit comments

Comments
 (0)