@@ -6808,6 +6808,7 @@ static void convertRequirements(Parser &P, SILFunction *F,
6808
6808
6809
6809
// / decl-sil-differentiability-witness ::=
6810
6810
// / 'sil_differentiability_witness'
6811
+ // / ('[' 'serialized' ']')?
6811
6812
// / '[' 'parameters' index-subset ']'
6812
6813
// / '[' 'results' index-subset ']'
6813
6814
// / ('[' 'where' derivatve-generic-signature-requirements ']')?
@@ -6830,6 +6831,17 @@ bool SILParserTUState::parseSILDifferentiabilityWitness(Parser &P) {
6830
6831
if (!linkage)
6831
6832
linkage = SILLinkage::PublicExternal;
6832
6833
6834
+ // Parse '[serialized]' flag (optional).
6835
+ bool isSerialized = false ;
6836
+ if (P.Tok .is (tok::l_square) && P.peekToken ().is (tok::identifier) &&
6837
+ P.peekToken ().getText () == " serialized" ) {
6838
+ isSerialized = true ;
6839
+ P.consumeToken (tok::l_square);
6840
+ P.consumeToken (tok::identifier);
6841
+ if (P.parseToken (tok::r_square, diag::sil_diff_witness_expected_token, " ]" ))
6842
+ return true ;
6843
+ }
6844
+
6833
6845
Scope scope (&P, ScopeKind::TopLevel);
6834
6846
Scope body (&P, ScopeKind::FunctionBody);
6835
6847
@@ -6970,8 +6982,6 @@ bool SILParserTUState::parseSILDifferentiabilityWitness(Parser &P) {
6970
6982
return true ;
6971
6983
}
6972
6984
6973
- // TODO(TF-893): Parse `isSerialized` flag.
6974
- bool isSerialized = false ;
6975
6985
SILDifferentiabilityWitness::create (
6976
6986
M, *linkage, originalFn, parameterIndices, resultIndices,
6977
6987
derivativeGenSig, jvp, vjp, isSerialized);
0 commit comments