Skip to content

Commit 4ed1175

Browse files
committed
[ClangImporter] Fix macOS app extension deprecated-as-unavailable check (swiftlang#25399)
Fixes a typo introduced in 8b14600 where a case was omitted from the refactored version of a switch. rdar://51417764 (cherry picked from commit 12e01d1)
1 parent f7331dd commit 4ed1175

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ PlatformAvailability::PlatformAvailability(LangOptions &langOpts)
17471747
"APIs deprecated as of macOS 10.9 and earlier are unavailable in Swift";
17481748
break;
17491749

1750-
default:
1750+
case PlatformKind::none:
17511751
break;
17521752
}
17531753
}
@@ -1788,7 +1788,11 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
17881788
Optional<unsigned> minor = version.getMinor();
17891789

17901790
switch (platformKind) {
1791+
case PlatformKind::none:
1792+
llvm_unreachable("version but no platform?");
1793+
17911794
case PlatformKind::OSX:
1795+
case PlatformKind::OSXApplicationExtension:
17921796
// Anything deprecated in OSX 10.9.x and earlier is unavailable in Swift.
17931797
return major < 10 ||
17941798
(major == 10 && (!minor.hasValue() || minor.getValue() <= 9));
@@ -1804,10 +1808,9 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
18041808
case PlatformKind::watchOSApplicationExtension:
18051809
// No deprecation filter on watchOS
18061810
return false;
1807-
1808-
default:
1809-
return false;
18101811
}
1812+
1813+
llvm_unreachable("Unexpected platform");
18111814
}
18121815

18131816
ClangImporter::Implementation::Implementation(ASTContext &ctx,

test/ClangImporter/availability_ios.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -application-extension %s
23

34
// REQUIRES: OS=ios
45

test/ClangImporter/availability_macosx.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules %s
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -application-extension %s
23

34
// REQUIRES: OS=macosx
45

0 commit comments

Comments
 (0)