Skip to content

Commit 12e01d1

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

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
@@ -1746,7 +1746,7 @@ PlatformAvailability::PlatformAvailability(LangOptions &langOpts)
17461746
"APIs deprecated as of macOS 10.9 and earlier are unavailable in Swift";
17471747
break;
17481748

1749-
default:
1749+
case PlatformKind::none:
17501750
break;
17511751
}
17521752
}
@@ -1787,7 +1787,11 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
17871787
Optional<unsigned> minor = version.getMinor();
17881788

17891789
switch (platformKind) {
1790+
case PlatformKind::none:
1791+
llvm_unreachable("version but no platform?");
1792+
17901793
case PlatformKind::OSX:
1794+
case PlatformKind::OSXApplicationExtension:
17911795
// Anything deprecated in OSX 10.9.x and earlier is unavailable in Swift.
17921796
return major < 10 ||
17931797
(major == 10 && (!minor.hasValue() || minor.getValue() <= 9));
@@ -1803,10 +1807,9 @@ bool PlatformAvailability::treatDeprecatedAsUnavailable(
18031807
case PlatformKind::watchOSApplicationExtension:
18041808
// No deprecation filter on watchOS
18051809
return false;
1806-
1807-
default:
1808-
return false;
18091810
}
1811+
1812+
llvm_unreachable("Unexpected platform");
18101813
}
18111814

18121815
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)