File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ AvailabilityContext ASTContext::getSwift50Availability() {
259259 return AvailabilityContext (
260260 VersionRange::allGTE (llvm::VersionTuple (12 ,2 )));
261261 } else if (target.isWatchOS ()) {
262- if (target.getArch () == llvm::Triple::ArchType::x86_64 )
262+ if (target.isArch64Bit () )
263263 return AvailabilityContext::alwaysAvailable ();
264264
265265 return AvailabilityContext (
@@ -297,6 +297,9 @@ AvailabilityContext ASTContext::getSwift51Availability() {
297297 return AvailabilityContext (
298298 VersionRange::allGTE (llvm::VersionTuple (13 ,0 ,0 )));
299299 } else if (target.isWatchOS ()) {
300+ if (target.isArch64Bit ())
301+ return AvailabilityContext::alwaysAvailable ();
302+
300303 return AvailabilityContext (
301304 VersionRange::allGTE (llvm::VersionTuple (6 ,0 ,0 )));
302305 } else {
Original file line number Diff line number Diff line change @@ -417,14 +417,20 @@ swift::getSwiftRuntimeCompatibilityVersionForTarget(
417417 }
418418 }
419419 } else if (Triple.isWatchOS ()) {
420+ auto floorFor64bits = [&Triple](llvm::VersionTuple v) {
421+ if (!Triple.isArch64Bit ()) return v;
422+ // 64-bit watchOS was introduced with Swift 5.3
423+ return MAX (v, llvm::VersionTuple (5 , 3 ));
424+ };
425+
420426 Triple.getWatchOSVersion (Major, Minor, Micro);
421427 if (Major <= 5 ) {
422- return llvm::VersionTuple (5 , 0 );
428+ return floorFor64bits ( llvm::VersionTuple (5 , 0 ) );
423429 } else if (Major <= 6 ) {
424430 if (Minor <= 1 ) {
425- return llvm::VersionTuple (5 , 1 );
431+ return floorFor64bits ( llvm::VersionTuple (5 , 1 ) );
426432 } else {
427- return llvm::VersionTuple (5 , 2 );
433+ return floorFor64bits ( llvm::VersionTuple (5 , 2 ) );
428434 }
429435 }
430436 }
You can’t perform that action at this time.
0 commit comments