Skip to content

Commit 1e38fc3

Browse files
committed
Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs
1 parent 4b9771c commit 1e38fc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1005
-389
lines changed

Diff for: apinotes/Accelerate.apinotes

-61
This file was deleted.

Diff for: apinotes/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
set(sources
2-
Accelerate.apinotes
32
Dispatch.apinotes
4-
ScriptingBridge.apinotes
53
os.apinotes
64
)
75

Diff for: apinotes/ScriptingBridge.apinotes

-5
This file was deleted.

Diff for: include/swift/AST/Attr.def

+5
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ DECL_ATTR(_private, PrivateImport,
394394
SIMPLE_DECL_ATTR(_alwaysEmitIntoClient, AlwaysEmitIntoClient,
395395
OnVar | OnSubscript | OnAbstractFunction | UserInaccessible,
396396
83)
397+
397398
SIMPLE_DECL_ATTR(_implementationOnly, ImplementationOnly,
398399
OnImport | UserInaccessible,
399400
84)
@@ -407,6 +408,10 @@ SIMPLE_DECL_ATTR(_disfavoredOverload, DisfavoredOverload,
407408
OnAbstractFunction | OnVar | OnSubscript | UserInaccessible,
408409
87)
409410

411+
SIMPLE_DECL_ATTR(IBSegueAction, IBSegueAction,
412+
OnFunc,
413+
95)
414+
410415
#undef TYPE_ATTR
411416
#undef DECL_ATTR_ALIAS
412417
#undef CONTEXTUAL_DECL_ATTR_ALIAS

Diff for: include/swift/AST/AvailabilitySpec.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ class PlatformVersionConstraintAvailabilitySpec : public AvailabilitySpec {
8383
/// The required platform.
8484
PlatformKind getPlatform() const { return Platform; }
8585
SourceLoc getPlatformLoc() const { return PlatformLoc; }
86-
86+
87+
/// Returns true when the constraint is for a platform that was not
88+
/// recognized. This enables better recovery during parsing but should never
89+
/// be true after parsing is completed.
90+
bool isUnrecognizedPlatform() const { return Platform == PlatformKind::none; }
91+
8792
// The platform version to compare against.
8893
llvm::VersionTuple getVersion() const { return Version; }
8994
SourceRange getVersionSrcRange() const { return VersionSrcRange; }

Diff for: include/swift/AST/Decl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6069,8 +6069,8 @@ class FuncDecl : public AbstractFunctionDecl {
60696069
/// True if the function is a defer body.
60706070
bool isDeferBody() const;
60716071

6072-
/// Perform basic checking to determine whether the @IBAction attribute can
6073-
/// be applied to this function.
6072+
/// Perform basic checking to determine whether the @IBAction or
6073+
/// @IBSegueAction attribute can be applied to this function.
60746074
bool isPotentialIBActionTarget() const;
60756075
};
60766076

Diff for: include/swift/AST/DiagnosticsParse.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -1575,8 +1575,8 @@ ERROR(avail_query_expected_version_number,PointsToFirstBadToken,
15751575
ERROR(avail_query_expected_rparen,PointsToFirstBadToken,
15761576
"expected ')' in availability query", ())
15771577

1578-
ERROR(avail_query_unrecognized_platform_name,
1579-
PointsToFirstBadToken, "unrecognized platform name %0", (Identifier))
1578+
WARNING(avail_query_unrecognized_platform_name,
1579+
PointsToFirstBadToken, "unrecognized platform name %0", (Identifier))
15801580

15811581
ERROR(avail_query_disallowed_operator, PointsToFirstBadToken,
15821582
"'%0' cannot be used in an availability condition", (StringRef))

Diff for: include/swift/AST/DiagnosticsSema.def

+22-15
Original file line numberDiff line numberDiff line change
@@ -1169,17 +1169,25 @@ ERROR(invalid_ibdesignable_extension,none,
11691169
ERROR(invalid_ibinspectable,none,
11701170
"only instance properties can be declared @%0", (StringRef))
11711171
ERROR(invalid_ibaction_decl,none,
1172-
"only instance methods can be declared @IBAction", ())
1172+
"only instance methods can be declared @%0", (StringRef))
11731173
ERROR(invalid_ibaction_result,none,
1174-
"methods declared @IBAction must return 'Void' (not %0)", (Type))
1174+
"methods declared @%0 must %select{|not }1return a value", (StringRef, bool))
11751175
ERROR(invalid_ibaction_argument_count,none,
1176-
"@IBAction methods %select{must have a single argument"
1177-
"|can only have up to 2 arguments}0", (bool))
1178-
ERROR(ibaction_nonobjc_class_argument,none,
1179-
"argument to @IBAction method cannot have non-'@objc' class type %0",
1180-
(Type))
1181-
ERROR(ibaction_nonobject_argument,none,
1182-
"argument to @IBAction method cannot have non-object type %0", (Type))
1176+
"@%0 methods must have %1 to %2 arguments",
1177+
(StringRef, int, int))
1178+
ERROR(invalid_ibaction_argument_count_exact,none,
1179+
"@%0 methods must have %2 argument%s2",
1180+
(StringRef, int, int))
1181+
ERROR(invalid_ibaction_argument_count_max,none,
1182+
"@%0 methods must have at most %2 argument%s2",
1183+
(StringRef, int, int))
1184+
ERROR(ibsegueaction_objc_method_family,none,
1185+
"@%0 method cannot have selector %1 because it has special memory "
1186+
"management behavior", (StringRef, ObjCSelector))
1187+
NOTE(fixit_rename_in_swift,none,
1188+
"change Swift name to %0", (DeclName))
1189+
NOTE(fixit_rename_in_objc,none,
1190+
"change Objective-C selector to %0", (ObjCSelector))
11831191
ERROR(no_objc_tagged_pointer_not_class_protocol,none,
11841192
"@unsafe_no_objc_tagged_pointer can only be applied to class protocols",
11851193
())
@@ -3664,8 +3672,8 @@ ERROR(objc_in_generic_extension,none,
36643672
"extensions of %select{classes from generic context|generic classes}0 "
36653673
"cannot contain '@objc' members", (bool))
36663674
ERROR(objc_in_resilient_extension,none,
3667-
"extensions of classes built with library evolution support "
3668-
"cannot contain '@objc' members", ())
3675+
"'@objc' %0 in extension of subclass of %1 requires %2 %3",
3676+
(DescriptiveDeclKind, Identifier, StringRef, llvm::VersionTuple))
36693677
ERROR(objc_operator, none,
36703678
"operator methods cannot be declared @objc", ())
36713679
ERROR(objc_operator_proto, none,
@@ -3687,9 +3695,8 @@ ERROR(objc_for_generic_class,none,
36873695
"generic subclasses of '@objc' classes cannot have an explicit '@objc' "
36883696
"because they are not directly visible from Objective-C", ())
36893697
ERROR(objc_for_resilient_class,none,
3690-
"classes built with library evolution support cannot have explicit "
3691-
"'@objc' subclasses because they are not directly "
3692-
"visible from Objective-C", ())
3698+
"explicit '@objc' on subclass of %0 requires %1 %2",
3699+
(Identifier, StringRef, llvm::VersionTuple))
36933700
ERROR(objc_getter_for_nonobjc_property,none,
36943701
"'@objc' getter for non-'@objc' property", ())
36953702
ERROR(objc_getter_for_nonobjc_subscript,none,
@@ -3730,7 +3737,7 @@ ERROR(objc_extension_not_class,none,
37303737
"'@objc' can only be applied to an extension of a class", ())
37313738

37323739
// If you change this, also change enum ObjCReason
3733-
#define OBJC_ATTR_SELECT "select{marked @_cdecl|marked dynamic|marked @objc|marked @IBOutlet|marked @IBAction|marked @NSManaged|a member of an @objc protocol|implicitly @objc|an @objc override|an implementation of an @objc requirement|marked @IBInspectable|marked @GKInspectable|in an @objc extension of a class (without @nonobjc)}"
3740+
#define OBJC_ATTR_SELECT "select{marked @_cdecl|marked dynamic|marked @objc|marked @IBOutlet|marked @IBAction|marked @IBSegueAction|marked @NSManaged|a member of an @objc protocol|implicitly @objc|an @objc override|an implementation of an @objc requirement|marked @IBInspectable|marked @GKInspectable|in an @objc extension of a class (without @nonobjc)}"
37343741

37353742
WARNING(attribute_meaningless_when_nonobjc,none,
37363743
"'@%0' attribute is meaningless on a property that cannot be "

Diff for: include/swift/Basic/LangOptions.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,6 @@ namespace swift {
305305
/// set to true.
306306
bool ExperimentalDependenciesIncludeIntrafileOnes = false;
307307

308-
/// Enable experimental support for emitting Objective-C resilient class
309-
/// stubs. This is a language option since it also determines if we admit
310-
/// @objc members in extensions of classes with resilient ancestry.
311-
bool EnableObjCResilientClassStubs = false;
312-
313308
/// Sets the target we are building for and updates platform conditions
314309
/// to match.
315310
///
@@ -403,6 +398,15 @@ namespace swift {
403398
// - watchOS 5.2
404399
bool doesTargetSupportObjCGetClassHook() const;
405400

401+
// The following deployment targets ship an Objective-C runtime supporting
402+
// the objc_loadClassref() entry point:
403+
//
404+
// - macOS 10.15
405+
// - iOS 13
406+
// - tvOS 13
407+
// - watchOS 6
408+
bool doesTargetSupportObjCClassStubs() const;
409+
406410
/// Returns true if the given platform condition argument represents
407411
/// a supported target operating system.
408412
///

Diff for: lib/AST/Availability.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,16 @@ AvailabilityContext AvailabilityInference::inferForType(Type t) {
220220
AvailabilityContext ASTContext::getOpaqueTypeAvailability() {
221221
auto target = LangOpts.Target;
222222

223-
if (target.isMacOSX()
224-
|| target.isiOS()
225-
|| target.isWatchOS()) {
226-
// TODO: Update with OS versions that ship with runtime support
223+
if (target.isMacOSX()) {
227224
return AvailabilityContext(
228-
VersionRange::allGTE(llvm::VersionTuple(9999,0,0)));
225+
VersionRange::allGTE(llvm::VersionTuple(10,15,0)));
226+
} else if (target.isiOS()) {
227+
return AvailabilityContext(
228+
VersionRange::allGTE(llvm::VersionTuple(13,0,0)));
229+
} else if (target.isWatchOS()) {
230+
return AvailabilityContext(
231+
VersionRange::allGTE(llvm::VersionTuple(6,0,0)));
232+
} else {
233+
return AvailabilityContext::alwaysAvailable();
229234
}
230-
231-
return AvailabilityContext::alwaysAvailable();
232235
}

Diff for: lib/Basic/LangOptions.cpp

+15-2
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,24 @@ bool LangOptions::doesTargetSupportObjCMetadataUpdateCallback() const {
284284
if (Target.isWatchOS())
285285
return !Target.isOSVersionLT(5, 2);
286286

287-
// If we're running on a non-Apple platform, we still want to allow running
288-
// tests that -enable-objc-interop.
287+
// Don't assert if we're running on a non-Apple platform; we still
288+
// want to allow running tests that -enable-objc-interop.
289289
return false;
290290
}
291291

292292
bool LangOptions::doesTargetSupportObjCGetClassHook() const {
293293
return doesTargetSupportObjCMetadataUpdateCallback();
294294
}
295+
296+
bool LangOptions::doesTargetSupportObjCClassStubs() const {
297+
if (Target.isMacOSX())
298+
return !Target.isMacOSXVersionLT(10, 15);
299+
if (Target.isiOS()) // also returns true on tvOS
300+
return !Target.isOSVersionLT(13);
301+
if (Target.isWatchOS())
302+
return !Target.isOSVersionLT(6);
303+
304+
// Don't assert if we're running on a non-Apple platform; we still
305+
// want to allow running tests that -enable-objc-interop.
306+
return false;
307+
}

Diff for: lib/ClangImporter/ImportDecl.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -4169,6 +4169,8 @@ namespace {
41694169
new (Impl.SwiftContext) IBActionAttr(/*IsImplicit=*/false));
41704170
}
41714171

4172+
// FIXME: Is there an IBSegueAction equivalent?
4173+
41724174
// Check whether there's some special method to import.
41734175
if (!forceClassMethod) {
41744176
if (dc == Impl.importDeclContextOf(decl, decl->getDeclContext()) &&

Diff for: lib/Frontend/CompilerInvocation.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
484484
Opts.DisableConstraintSolverPerformanceHacks |=
485485
Args.hasArg(OPT_disable_constraint_solver_performance_hacks);
486486

487-
Opts.EnableObjCResilientClassStubs =
488-
Args.hasArg(OPT_enable_objc_resilient_class_stubs);
489-
490487
// Must be processed after any other language options that could affect
491488
// platform conditions.
492489
bool UnsupportedOS, UnsupportedArch;

Diff for: lib/Index/Index.cpp

+17-10
Original file line numberDiff line numberDiff line change
@@ -1244,17 +1244,24 @@ bool IndexSwiftASTWalker::initFuncDeclIndexSymbol(FuncDecl *D,
12441244
Info.roles |= (SymbolRoleSet)SymbolRole::Dynamic;
12451245
}
12461246

1247-
if (D->getAttrs().hasAttribute<IBActionAttr>()) {
1248-
// Relate with type of the first parameter using RelationIBTypeOf.
1249-
if (D->hasImplicitSelfDecl()) {
1250-
auto paramList = D->getParameters();
1251-
if (!paramList->getArray().empty()) {
1252-
auto param = paramList->get(0);
1253-
if (auto nominal = param->getType()->getAnyNominal()) {
1254-
addRelation(Info, (SymbolRoleSet) SymbolRole::RelationIBTypeOf, nominal);
1255-
}
1256-
}
1247+
if (D->hasImplicitSelfDecl()) {
1248+
// If this is an @IBAction or @IBSegueAction method, find the sender
1249+
// parameter (if present) and relate the method to its type.
1250+
ParamDecl *senderParam = nullptr;
1251+
1252+
auto paramList = D->getParameters();
1253+
if (D->getAttrs().hasAttribute<IBActionAttr>()) {
1254+
if (paramList->size() > 0)
1255+
senderParam = paramList->get(0);
1256+
} else if (D->getAttrs().hasAttribute<IBSegueActionAttr>()) {
1257+
if (paramList->size() > 1)
1258+
senderParam = paramList->get(1);
12571259
}
1260+
1261+
if (senderParam)
1262+
if (auto nominal = senderParam->getType()->getAnyNominal())
1263+
addRelation(Info, (SymbolRoleSet) SymbolRole::RelationIBTypeOf,
1264+
nominal);
12581265
}
12591266

12601267
if (auto Group = D->getGroupName())

Diff for: lib/Index/IndexSymbol.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static bool isUnitTest(const ValueDecl *D) {
8484
static void setFuncSymbolInfo(const FuncDecl *FD, SymbolInfo &sym) {
8585
sym.Kind = SymbolKind::Function;
8686

87-
if (FD->getAttrs().hasAttribute<IBActionAttr>())
87+
if (FD->getAttrs().hasAttribute<IBActionAttr>() ||
88+
FD->getAttrs().hasAttribute<IBSegueActionAttr>())
8889
sym.Properties |= SymbolProperty::IBAnnotated;
8990

9091
if (isUnitTest(FD))

Diff for: lib/Parse/ParseExpr.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3649,7 +3649,7 @@ Parser::parsePlatformVersionConstraintSpec() {
36493649
if (!Platform.hasValue() || Platform.getValue() == PlatformKind::none) {
36503650
diagnose(Tok, diag::avail_query_unrecognized_platform_name,
36513651
PlatformIdentifier);
3652-
return nullptr;
3652+
Platform = PlatformKind::none;
36533653
}
36543654

36553655
// Register the platform name as a keyword token.

Diff for: lib/Parse/ParseStmt.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -1214,9 +1214,10 @@ static void parseGuardedPattern(Parser &P, GuardedPattern &result,
12141214
}
12151215
}
12161216

1217-
/// Validate availability spec list, emitting diagnostics if necessary.
1217+
/// Validate availability spec list, emitting diagnostics if necessary and removing
1218+
/// specs for unrecognized platforms.
12181219
static void validateAvailabilitySpecList(Parser &P,
1219-
ArrayRef<AvailabilitySpec *> Specs) {
1220+
SmallVectorImpl<AvailabilitySpec *> &Specs) {
12201221
llvm::SmallSet<PlatformKind, 4> Platforms;
12211222
bool HasOtherPlatformSpec = false;
12221223

@@ -1228,7 +1229,9 @@ static void validateAvailabilitySpecList(Parser &P,
12281229
return;
12291230
}
12301231

1232+
SmallVector<AvailabilitySpec *, 5> RecognizedSpecs;
12311233
for (auto *Spec : Specs) {
1234+
RecognizedSpecs.push_back(Spec);
12321235
if (isa<OtherPlatformAvailabilitySpec>(Spec)) {
12331236
HasOtherPlatformSpec = true;
12341237
continue;
@@ -1243,6 +1246,13 @@ static void validateAvailabilitySpecList(Parser &P,
12431246
}
12441247

12451248
auto *VersionSpec = cast<PlatformVersionConstraintAvailabilitySpec>(Spec);
1249+
// We keep specs for unrecognized platforms around for error recovery
1250+
// during parsing but remove them once parsing is completed.
1251+
if (VersionSpec->isUnrecognizedPlatform()) {
1252+
RecognizedSpecs.pop_back();
1253+
continue;
1254+
}
1255+
12461256
bool Inserted = Platforms.insert(VersionSpec->getPlatform()).second;
12471257
if (!Inserted) {
12481258
// Rule out multiple version specs referring to the same platform.
@@ -1260,6 +1270,8 @@ static void validateAvailabilitySpecList(Parser &P,
12601270
P.diagnose(InsertWildcardLoc, diag::availability_query_wildcard_required)
12611271
.fixItInsertAfter(InsertWildcardLoc, ", *");
12621272
}
1273+
1274+
Specs = RecognizedSpecs;
12631275
}
12641276

12651277
// #available(...)

0 commit comments

Comments
 (0)