@@ -2520,9 +2520,10 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
25202520
25212521 auto parseForwardingOwnershipKind =
25222522 [&](ValueOwnershipKind &forwardingKind) -> bool {
2523- if (P.consumeIf (tok::comma)) {
2524- return parseVerbatim (" forwarding" ) ||
2525- P.parseToken (tok::colon, diag::expected_tok_in_sil_instr, " :" ) ||
2523+ if (P.consumeIf (tok::comma) &&
2524+ P.Tok .is (tok::identifier) && P.Tok .getText () == " forwarding" ) {
2525+ P.consumeToken ();
2526+ return P.parseToken (tok::colon, diag::expected_tok_in_sil_instr, " :" ) ||
25262527 parseSILOwnership (forwardingKind);
25272528 }
25282529 return false ;
@@ -2944,7 +2945,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
29442945
29452946 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
29462947 if (parseForwardingOwnershipKind (forwardingOwnership) ||
2947- parseSILDebugLocation (InstLoc, B))
2948+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
29482949 return true ;
29492950 ResultVal =
29502951 B.createOpenExistentialBoxValue (InstLoc, Val, Ty, forwardingOwnership);
@@ -2964,7 +2965,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
29642965
29652966 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
29662967 if (parseForwardingOwnershipKind (forwardingOwnership) ||
2967- parseSILDebugLocation (InstLoc, B))
2968+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
29682969 return true ;
29692970
29702971 ResultVal =
@@ -2978,7 +2979,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
29782979
29792980 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
29802981 if (parseForwardingOwnershipKind (forwardingOwnership) ||
2981- parseSILDebugLocation (InstLoc, B))
2982+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
29822983 return true ;
29832984
29842985 ResultVal =
@@ -3204,7 +3205,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
32043205
32053206 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
32063207 if (parseForwardingOwnershipKind (forwardingOwnership) ||
3207- parseSILDebugLocation (InstLoc, B))
3208+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
32083209 return true ;
32093210
32103211 ResultVal = B.createMarkDependence (InstLoc, Val, Base, forwardingOwnership);
@@ -3403,7 +3404,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
34033404 return true ;
34043405 }
34053406
3406- if (parseSILDebugLocation (InstLoc, B)) {
3407+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true )) {
34073408 return true ;
34083409 }
34093410
@@ -3522,7 +3523,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
35223523
35233524 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
35243525 if (parseForwardingOwnershipKind (forwardingOwnership) ||
3525- parseSILDebugLocation (InstLoc, B))
3526+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
35263527 return true ;
35273528
35283529 ResultVal =
@@ -3600,7 +3601,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
36003601
36013602 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
36023603 if (parseForwardingOwnershipKind (forwardingOwnership) ||
3603- parseSILDebugLocation (InstLoc, B))
3604+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
36043605 return true ;
36053606
36063607 auto opaque = Lowering::AbstractionPattern::getOpaque ();
@@ -3683,7 +3684,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
36833684
36843685 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
36853686 if (parseForwardingOwnershipKind (forwardingOwnership) ||
3686- parseSILDebugLocation (InstLoc, B))
3687+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
36873688 return true ;
36883689
36893690 ResultVal =
@@ -4157,7 +4158,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
41574158 : ValueOwnershipKind (OwnershipKind::None);
41584159
41594160 if (parseForwardingOwnershipKind (forwardingOwnership) ||
4160- parseSILDebugLocation (InstLoc, B))
4161+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
41614162 return true ;
41624163
41634164 ResultVal = B.createTuple (InstLoc, Ty2, OpList, forwardingOwnership);
@@ -4231,7 +4232,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
42314232 : ValueOwnershipKind (OwnershipKind::None);
42324233
42334234 if (parseForwardingOwnershipKind (forwardingOwnership) ||
4234- parseSILDebugLocation (InstLoc, B))
4235+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
42354236 return true ;
42364237
42374238 ResultVal =
@@ -4253,7 +4254,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
42534254 if (Opcode == SILInstructionKind::UncheckedEnumDataInst)
42544255 parseForwardingOwnershipKind (forwardingOwnership);
42554256
4256- if (parseSILDebugLocation (InstLoc, B))
4257+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
42574258 return true ;
42584259 EnumElementDecl *Elt = cast<EnumElementDecl>(EltRef.getDecl ());
42594260 auto ResultTy = Operand->getType ().getEnumElementType (
@@ -4312,7 +4313,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
43124313 return true ;
43134314 }
43144315
4315- if (parseSILDebugLocation (InstLoc, B))
4316+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
43164317 return true ;
43174318 auto ResultTy = TT->getElement (Field).getType ()->getCanonicalType ();
43184319 if (Opcode == SILInstructionKind::TupleElementAddrInst)
@@ -4588,7 +4589,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
45884589 F && F->hasOwnership () ? mergeSILValueOwnership (OpList)
45894590 : ValueOwnershipKind (OwnershipKind::None);
45904591 if (parseForwardingOwnershipKind (forwardingOwnership) ||
4591- parseSILDebugLocation (InstLoc, B)) {
4592+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true )) {
45924593 return true ;
45934594 }
45944595 if (Opcode == SILInstructionKind::StructInst) {
@@ -4614,7 +4615,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
46144615 return true ;
46154616 }
46164617
4617- if (parseSILDebugLocation (InstLoc, B))
4618+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
46184619 return true ;
46194620 if (!FieldV || !isa<VarDecl>(FieldV)) {
46204621 P.diagnose (NameLoc, diag::sil_struct_inst_wrong_field);
@@ -4830,7 +4831,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
48304831 if (parseForwardingOwnershipKind (forwardingOwnership))
48314832 return true ;
48324833 }
4833- if (parseSILDebugLocation (InstLoc, B))
4834+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
48344835 return true ;
48354836
48364837 // Resolve the results.
@@ -4893,7 +4894,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
48934894 return true ;
48944895 }
48954896
4896- if (parseSILDebugLocation (InstLoc, B))
4897+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
48974898 return true ;
48984899 if (Opcode == SILInstructionKind::SwitchEnumInst) {
48994900 ResultVal = B.createSwitchEnum (InstLoc, Val, DefaultBB, CaseBBs, None,
@@ -5143,7 +5144,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
51435144
51445145 ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
51455146 if (parseForwardingOwnershipKind (forwardingOwnership) ||
5146- parseSILDebugLocation (InstLoc, B))
5147+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
51475148 return true ;
51485149
51495150 ArrayRef<ProtocolConformanceRef> conformances =
@@ -5311,7 +5312,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
53115312
53125313 ValueOwnershipKind forwardingOwnership (OwnershipKind::None);
53135314 if (parseForwardingOwnershipKind (forwardingOwnership) ||
5314- parseSILDebugLocation (InstLoc, B))
5315+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
53155316 return true ;
53165317 auto *parameterIndices = IndexSubset::get (
53175318 P.Context , fnType->getNumParameters (), rawParameterIndices);
@@ -5360,7 +5361,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
53605361
53615362 ValueOwnershipKind forwardingOwnership (OwnershipKind::None);
53625363 if (parseForwardingOwnershipKind (forwardingOwnership) ||
5363- parseSILDebugLocation (InstLoc, B))
5364+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
53645365 return true ;
53655366
53665367 auto *parameterIndicesSubset = IndexSubset::get (
@@ -5406,7 +5407,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
54065407 ValueOwnershipKind forwardingOwnership =
54075408 functionOperand.getOwnershipKind ();
54085409 if (parseForwardingOwnershipKind (forwardingOwnership) ||
5409- parseSILDebugLocation (InstLoc, B))
5410+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
54105411 return true ;
54115412
54125413 ResultVal = B.createDifferentiableFunctionExtract (
@@ -5434,7 +5435,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
54345435 ValueOwnershipKind forwardingOwnership =
54355436 functionOperand.getOwnershipKind ();
54365437 if (parseForwardingOwnershipKind (forwardingOwnership) ||
5437- parseSILDebugLocation (InstLoc, B))
5438+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
54385439 return true ;
54395440 ResultVal = B.createLinearFunctionExtract (
54405441 InstLoc, extractee, functionOperand, forwardingOwnership);
0 commit comments