@@ -2520,9 +2520,10 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
2520
2520
2521
2521
auto parseForwardingOwnershipKind =
2522
2522
[&](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, " :" ) ||
2526
2527
parseSILOwnership (forwardingKind);
2527
2528
}
2528
2529
return false ;
@@ -2944,7 +2945,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
2944
2945
2945
2946
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
2946
2947
if (parseForwardingOwnershipKind (forwardingOwnership) ||
2947
- parseSILDebugLocation (InstLoc, B))
2948
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
2948
2949
return true ;
2949
2950
ResultVal =
2950
2951
B.createOpenExistentialBoxValue (InstLoc, Val, Ty, forwardingOwnership);
@@ -2964,7 +2965,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
2964
2965
2965
2966
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
2966
2967
if (parseForwardingOwnershipKind (forwardingOwnership) ||
2967
- parseSILDebugLocation (InstLoc, B))
2968
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
2968
2969
return true ;
2969
2970
2970
2971
ResultVal =
@@ -2978,7 +2979,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
2978
2979
2979
2980
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
2980
2981
if (parseForwardingOwnershipKind (forwardingOwnership) ||
2981
- parseSILDebugLocation (InstLoc, B))
2982
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
2982
2983
return true ;
2983
2984
2984
2985
ResultVal =
@@ -3204,7 +3205,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
3204
3205
3205
3206
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
3206
3207
if (parseForwardingOwnershipKind (forwardingOwnership) ||
3207
- parseSILDebugLocation (InstLoc, B))
3208
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
3208
3209
return true ;
3209
3210
3210
3211
ResultVal = B.createMarkDependence (InstLoc, Val, Base, forwardingOwnership);
@@ -3403,7 +3404,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
3403
3404
return true ;
3404
3405
}
3405
3406
3406
- if (parseSILDebugLocation (InstLoc, B)) {
3407
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true )) {
3407
3408
return true ;
3408
3409
}
3409
3410
@@ -3522,7 +3523,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
3522
3523
3523
3524
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
3524
3525
if (parseForwardingOwnershipKind (forwardingOwnership) ||
3525
- parseSILDebugLocation (InstLoc, B))
3526
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
3526
3527
return true ;
3527
3528
3528
3529
ResultVal =
@@ -3600,7 +3601,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
3600
3601
3601
3602
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
3602
3603
if (parseForwardingOwnershipKind (forwardingOwnership) ||
3603
- parseSILDebugLocation (InstLoc, B))
3604
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
3604
3605
return true ;
3605
3606
3606
3607
auto opaque = Lowering::AbstractionPattern::getOpaque ();
@@ -3683,7 +3684,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
3683
3684
3684
3685
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
3685
3686
if (parseForwardingOwnershipKind (forwardingOwnership) ||
3686
- parseSILDebugLocation (InstLoc, B))
3687
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
3687
3688
return true ;
3688
3689
3689
3690
ResultVal =
@@ -4157,7 +4158,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4157
4158
: ValueOwnershipKind (OwnershipKind::None);
4158
4159
4159
4160
if (parseForwardingOwnershipKind (forwardingOwnership) ||
4160
- parseSILDebugLocation (InstLoc, B))
4161
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4161
4162
return true ;
4162
4163
4163
4164
ResultVal = B.createTuple (InstLoc, Ty2, OpList, forwardingOwnership);
@@ -4231,7 +4232,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4231
4232
: ValueOwnershipKind (OwnershipKind::None);
4232
4233
4233
4234
if (parseForwardingOwnershipKind (forwardingOwnership) ||
4234
- parseSILDebugLocation (InstLoc, B))
4235
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4235
4236
return true ;
4236
4237
4237
4238
ResultVal =
@@ -4253,7 +4254,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4253
4254
if (Opcode == SILInstructionKind::UncheckedEnumDataInst)
4254
4255
parseForwardingOwnershipKind (forwardingOwnership);
4255
4256
4256
- if (parseSILDebugLocation (InstLoc, B))
4257
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4257
4258
return true ;
4258
4259
EnumElementDecl *Elt = cast<EnumElementDecl>(EltRef.getDecl ());
4259
4260
auto ResultTy = Operand->getType ().getEnumElementType (
@@ -4312,7 +4313,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4312
4313
return true ;
4313
4314
}
4314
4315
4315
- if (parseSILDebugLocation (InstLoc, B))
4316
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4316
4317
return true ;
4317
4318
auto ResultTy = TT->getElement (Field).getType ()->getCanonicalType ();
4318
4319
if (Opcode == SILInstructionKind::TupleElementAddrInst)
@@ -4588,7 +4589,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4588
4589
F && F->hasOwnership () ? mergeSILValueOwnership (OpList)
4589
4590
: ValueOwnershipKind (OwnershipKind::None);
4590
4591
if (parseForwardingOwnershipKind (forwardingOwnership) ||
4591
- parseSILDebugLocation (InstLoc, B)) {
4592
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true )) {
4592
4593
return true ;
4593
4594
}
4594
4595
if (Opcode == SILInstructionKind::StructInst) {
@@ -4614,7 +4615,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4614
4615
return true ;
4615
4616
}
4616
4617
4617
- if (parseSILDebugLocation (InstLoc, B))
4618
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4618
4619
return true ;
4619
4620
if (!FieldV || !isa<VarDecl>(FieldV)) {
4620
4621
P.diagnose (NameLoc, diag::sil_struct_inst_wrong_field);
@@ -4830,7 +4831,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4830
4831
if (parseForwardingOwnershipKind (forwardingOwnership))
4831
4832
return true ;
4832
4833
}
4833
- if (parseSILDebugLocation (InstLoc, B))
4834
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4834
4835
return true ;
4835
4836
4836
4837
// Resolve the results.
@@ -4893,7 +4894,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
4893
4894
return true ;
4894
4895
}
4895
4896
4896
- if (parseSILDebugLocation (InstLoc, B))
4897
+ if (parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
4897
4898
return true ;
4898
4899
if (Opcode == SILInstructionKind::SwitchEnumInst) {
4899
4900
ResultVal = B.createSwitchEnum (InstLoc, Val, DefaultBB, CaseBBs, None,
@@ -5143,7 +5144,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
5143
5144
5144
5145
ValueOwnershipKind forwardingOwnership = Val.getOwnershipKind ();
5145
5146
if (parseForwardingOwnershipKind (forwardingOwnership) ||
5146
- parseSILDebugLocation (InstLoc, B))
5147
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
5147
5148
return true ;
5148
5149
5149
5150
ArrayRef<ProtocolConformanceRef> conformances =
@@ -5311,7 +5312,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
5311
5312
5312
5313
ValueOwnershipKind forwardingOwnership (OwnershipKind::None);
5313
5314
if (parseForwardingOwnershipKind (forwardingOwnership) ||
5314
- parseSILDebugLocation (InstLoc, B))
5315
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
5315
5316
return true ;
5316
5317
auto *parameterIndices = IndexSubset::get (
5317
5318
P.Context , fnType->getNumParameters (), rawParameterIndices);
@@ -5360,7 +5361,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
5360
5361
5361
5362
ValueOwnershipKind forwardingOwnership (OwnershipKind::None);
5362
5363
if (parseForwardingOwnershipKind (forwardingOwnership) ||
5363
- parseSILDebugLocation (InstLoc, B))
5364
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
5364
5365
return true ;
5365
5366
5366
5367
auto *parameterIndicesSubset = IndexSubset::get (
@@ -5406,7 +5407,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
5406
5407
ValueOwnershipKind forwardingOwnership =
5407
5408
functionOperand.getOwnershipKind ();
5408
5409
if (parseForwardingOwnershipKind (forwardingOwnership) ||
5409
- parseSILDebugLocation (InstLoc, B))
5410
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
5410
5411
return true ;
5411
5412
5412
5413
ResultVal = B.createDifferentiableFunctionExtract (
@@ -5434,7 +5435,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
5434
5435
ValueOwnershipKind forwardingOwnership =
5435
5436
functionOperand.getOwnershipKind ();
5436
5437
if (parseForwardingOwnershipKind (forwardingOwnership) ||
5437
- parseSILDebugLocation (InstLoc, B))
5438
+ parseSILDebugLocation (InstLoc, B, /* parsedComma= */ true ))
5438
5439
return true ;
5439
5440
ResultVal = B.createLinearFunctionExtract (
5440
5441
InstLoc, extractee, functionOperand, forwardingOwnership);
0 commit comments