@@ -1306,24 +1306,25 @@ validateAvailabilitySpecList(Parser &P,
1306
1306
for (auto *Spec : Specs) {
1307
1307
RecognizedSpecs.push_back (Spec);
1308
1308
if (auto *OtherPlatSpec = dyn_cast<OtherPlatformAvailabilitySpec>(Spec)) {
1309
- OtherPlatformSpecLoc = OtherPlatSpec->getStarLoc ();
1309
+ OtherPlatformSpecLoc = OtherPlatSpec->getStartLoc ();
1310
1310
continue ;
1311
1311
}
1312
1312
1313
1313
if (auto *PlatformAgnosticSpec =
1314
1314
dyn_cast<PlatformAgnosticVersionConstraintAvailabilitySpec>(Spec)) {
1315
- P.diagnose (PlatformAgnosticSpec->getPlatformAgnosticNameLoc (),
1315
+ bool isLanguageVersionSpecific = PlatformAgnosticSpec->getDomain ()->isSwiftLanguage ();
1316
+ P.diagnose (PlatformAgnosticSpec->getStartLoc (),
1316
1317
diag::availability_must_occur_alone,
1317
- PlatformAgnosticSpec-> isLanguageVersionSpecific ()
1318
- ? " swift"
1319
- : " _PackageDescription" );
1318
+ isLanguageVersionSpecific
1319
+ ? " swift"
1320
+ : " _PackageDescription" );
1320
1321
continue ;
1321
1322
}
1322
1323
1323
1324
auto *VersionSpec = cast<PlatformVersionConstraintAvailabilitySpec>(Spec);
1324
1325
// We keep specs for unrecognized platforms around for error recovery
1325
1326
// during parsing but remove them once parsing is completed.
1326
- if (VersionSpec->isUnrecognizedPlatform ()) {
1327
+ if (! VersionSpec->getDomain (). has_value ()) {
1327
1328
RecognizedSpecs.pop_back ();
1328
1329
continue ;
1329
1330
}
@@ -1334,7 +1335,7 @@ validateAvailabilitySpecList(Parser &P,
1334
1335
// For example, we emit an error for
1335
1336
// / #available(OSX 10.10, OSX 10.11, *)
1336
1337
PlatformKind Platform = VersionSpec->getPlatform ();
1337
- P.diagnose (VersionSpec->getPlatformLoc (),
1338
+ P.diagnose (VersionSpec->getStartLoc (),
1338
1339
diag::availability_query_repeated_platform,
1339
1340
platformString (Platform));
1340
1341
}
@@ -1404,8 +1405,9 @@ ParserResult<PoundAvailableInfo> Parser::parseStmtConditionPoundAvailable() {
1404
1405
for (auto *Spec : Specs) {
1405
1406
if (auto *PlatformAgnostic =
1406
1407
dyn_cast<PlatformAgnosticVersionConstraintAvailabilitySpec>(Spec)) {
1407
- diagnose (PlatformAgnostic->getPlatformAgnosticNameLoc (),
1408
- PlatformAgnostic->isLanguageVersionSpecific ()
1408
+ bool isLanguageVersionSpecific = PlatformAgnostic->getDomain ()->isSwiftLanguage ();
1409
+ diagnose (PlatformAgnostic->getStartLoc (),
1410
+ isLanguageVersionSpecific
1409
1411
? diag::pound_available_swift_not_allowed
1410
1412
: diag::pound_available_package_description_not_allowed,
1411
1413
getTokenText (MainToken));
@@ -1551,11 +1553,10 @@ Parser::parseAvailabilitySpecList(SmallVectorImpl<AvailabilitySpec *> &Specs,
1551
1553
auto *PlatformSpec =
1552
1554
cast<PlatformVersionConstraintAvailabilitySpec>(Previous);
1553
1555
1554
- auto PlatformNameEndLoc =
1555
- Lexer::getLocForEndOfToken (SourceManager,
1556
- PlatformSpec->getPlatformLoc ());
1556
+ auto PlatformNameEndLoc = Lexer::getLocForEndOfToken (
1557
+ SourceManager, PlatformSpec->getStartLoc ());
1557
1558
1558
- diagnose (PlatformSpec->getPlatformLoc (),
1559
+ diagnose (PlatformSpec->getStartLoc (),
1559
1560
diag::avail_query_meant_introduced)
1560
1561
.fixItInsert (PlatformNameEndLoc, " , introduced:" );
1561
1562
}
0 commit comments