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