@@ -663,37 +663,24 @@ void SILParser::convertRequirements(ArrayRef<RequirementRepr> From,
663
663
}
664
664
}
665
665
666
- static bool parseDeclSILOptional (bool *isTransparent,
667
- IsSerialized_t *isSerialized,
668
- bool *isCanonical,
669
- bool *hasOwnershipSSA,
670
- IsThunk_t *isThunk,
671
- IsDynamicallyReplaceable_t *isDynamic,
672
- IsDistributed_t *isDistributed,
673
- IsRuntimeAccessible_t *isRuntimeAccessible,
674
- ForceEnableLexicalLifetimes_t *forceEnableLexicalLifetimes,
675
- UseStackForPackMetadata_t *useStackForPackMetadata,
676
- bool *hasUnsafeNonEscapableResult,
677
- IsExactSelfClass_t *isExactSelfClass,
678
- SILFunction **dynamicallyReplacedFunction,
679
- SILFunction **usedAdHocRequirementWitness,
680
- Identifier *objCReplacementFor,
681
- SILFunction::Purpose *specialPurpose,
682
- Inline_t *inlineStrategy,
683
- OptimizationMode *optimizationMode,
684
- PerformanceConstraints *perfConstraints,
685
- bool *markedAsUsed,
686
- StringRef *section,
687
- bool *isLet,
688
- bool *isWeakImported,
689
- bool *needStackProtection,
690
- AvailabilityContext *availability,
691
- bool *isWithoutActuallyEscapingThunk,
692
- SmallVectorImpl<std::string> *Semantics,
693
- SmallVectorImpl<ParsedSpecAttr> *SpecAttrs,
694
- ValueDecl **ClangDecl,
695
- EffectsKind *MRK,
696
- SILParser &SP, SILModule &M) {
666
+ static bool parseDeclSILOptional (
667
+ bool *isTransparent, IsSerialized_t *isSerialized, bool *isCanonical,
668
+ bool *hasOwnershipSSA, bool *hasResultDependsOnSelf, IsThunk_t *isThunk,
669
+ IsDynamicallyReplaceable_t *isDynamic, IsDistributed_t *isDistributed,
670
+ IsRuntimeAccessible_t *isRuntimeAccessible,
671
+ ForceEnableLexicalLifetimes_t *forceEnableLexicalLifetimes,
672
+ UseStackForPackMetadata_t *useStackForPackMetadata,
673
+ bool *hasUnsafeNonEscapableResult, IsExactSelfClass_t *isExactSelfClass,
674
+ SILFunction **dynamicallyReplacedFunction,
675
+ SILFunction **usedAdHocRequirementWitness, Identifier *objCReplacementFor,
676
+ SILFunction::Purpose *specialPurpose, Inline_t *inlineStrategy,
677
+ OptimizationMode *optimizationMode, PerformanceConstraints *perfConstraints,
678
+ bool *markedAsUsed, StringRef *section, bool *isLet, bool *isWeakImported,
679
+ bool *needStackProtection, AvailabilityContext *availability,
680
+ bool *isWithoutActuallyEscapingThunk,
681
+ SmallVectorImpl<std::string> *Semantics,
682
+ SmallVectorImpl<ParsedSpecAttr> *SpecAttrs, ValueDecl **ClangDecl,
683
+ EffectsKind *MRK, SILParser &SP, SILModule &M) {
697
684
while (SP.P .consumeIf (tok::l_square)) {
698
685
if (isLet && SP.P .Tok .is (tok::kw_let)) {
699
686
*isLet = true ;
@@ -729,6 +716,9 @@ static bool parseDeclSILOptional(bool *isTransparent,
729
716
*isCanonical = true ;
730
717
else if (hasOwnershipSSA && SP.P .Tok .getText () == " ossa" )
731
718
*hasOwnershipSSA = true ;
719
+ else if (hasResultDependsOnSelf &&
720
+ SP.P .Tok .getText () == " _resultDependsOnSelf" )
721
+ *hasResultDependsOnSelf = true ;
732
722
else if (needStackProtection && SP.P .Tok .getText () == " stack_protection" )
733
723
*needStackProtection = true ;
734
724
else if (isThunk && SP.P .Tok .getText () == " thunk" )
@@ -6883,9 +6873,11 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
6883
6873
bool foundEagerMove = false ;
6884
6874
bool foundReborrow = false ;
6885
6875
bool hasPointerEscape = false ;
6886
- while (auto attributeName = parseOptionalAttribute (
6887
- {" noImplicitCopy" , " _lexical" , " _eagerMove" ,
6888
- " closureCapture" , " reborrow" , " pointer_escape" })) {
6876
+ bool hasResultDependsOn = false ;
6877
+ while (
6878
+ auto attributeName = parseOptionalAttribute (
6879
+ {" noImplicitCopy" , " _lexical" , " _eagerMove" , " closureCapture" ,
6880
+ " reborrow" , " pointer_escape" , " _resultDependsOn" })) {
6889
6881
if (*attributeName == " noImplicitCopy" )
6890
6882
foundNoImplicitCopy = true ;
6891
6883
else if (*attributeName == " _lexical" )
@@ -6898,6 +6890,8 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
6898
6890
foundReborrow = true ;
6899
6891
else if (*attributeName == " pointer_escape" )
6900
6892
hasPointerEscape = true ;
6893
+ else if (*attributeName == " _resultDependsOn" )
6894
+ hasResultDependsOn = true ;
6901
6895
else {
6902
6896
llvm_unreachable (" Unexpected attribute!" );
6903
6897
}
@@ -6930,6 +6924,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
6930
6924
fArg ->setLifetimeAnnotation (lifetime);
6931
6925
fArg ->setReborrow (foundReborrow);
6932
6926
fArg ->setHasPointerEscape (hasPointerEscape);
6927
+ fArg ->setHasResultDependsOn (hasResultDependsOn);
6933
6928
Arg = fArg ;
6934
6929
6935
6930
// Today, we construct the ownership kind straight from the function
@@ -7013,6 +7008,7 @@ bool SILParserState::parseDeclSIL(Parser &P) {
7013
7008
bool hasUnsafeNonEscapableResult = false ;
7014
7009
IsExactSelfClass_t isExactSelfClass = IsNotExactSelfClass;
7015
7010
bool hasOwnershipSSA = false ;
7011
+ bool hasResultDependsOnSelf = false ;
7016
7012
IsThunk_t isThunk = IsNotThunk;
7017
7013
SILFunction::Purpose specialPurpose = SILFunction::Purpose::None;
7018
7014
bool isWeakImported = false ;
@@ -7034,9 +7030,9 @@ bool SILParserState::parseDeclSIL(Parser &P) {
7034
7030
if (parseSILLinkage (FnLinkage, P) ||
7035
7031
parseDeclSILOptional (
7036
7032
&isTransparent, &isSerialized, &isCanonical, &hasOwnershipSSA,
7037
- &isThunk , &isDynamic , &isDistributed , &isRuntimeAccessible ,
7038
- &forceEnableLexicalLifetimes , &useStackForPackMetadata ,
7039
- &hasUnsafeNonEscapableResult,
7033
+ &hasResultDependsOnSelf , &isThunk , &isDynamic , &isDistributed ,
7034
+ &isRuntimeAccessible , &forceEnableLexicalLifetimes ,
7035
+ &useStackForPackMetadata, & hasUnsafeNonEscapableResult,
7040
7036
&isExactSelfClass, &DynamicallyReplacedFunction,
7041
7037
&AdHocWitnessFunction, &objCReplacementFor, &specialPurpose,
7042
7038
&inlineStrategy, &optimizationMode, &perfConstr, &markedAsUsed,
@@ -7070,6 +7066,7 @@ bool SILParserState::parseDeclSIL(Parser &P) {
7070
7066
FunctionState.F ->setWasDeserializedCanonical (isCanonical);
7071
7067
if (!hasOwnershipSSA)
7072
7068
FunctionState.F ->setOwnershipEliminated ();
7069
+ FunctionState.F ->setHasResultDependsOnSelf (hasResultDependsOnSelf);
7073
7070
FunctionState.F ->setThunk (IsThunk_t (isThunk));
7074
7071
FunctionState.F ->setIsDynamic (isDynamic);
7075
7072
FunctionState.F ->setIsDistributed (isDistributed);
@@ -7290,9 +7287,9 @@ bool SILParserState::parseSILGlobal(Parser &P) {
7290
7287
parseDeclSILOptional (nullptr , &isSerialized, nullptr , nullptr , nullptr ,
7291
7288
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7292
7289
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7293
- nullptr , nullptr , nullptr , nullptr , &isLet, nullptr ,
7290
+ nullptr , nullptr , nullptr , nullptr , nullptr , &isLet ,
7294
7291
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7295
- nullptr , State, M) ||
7292
+ nullptr , nullptr , State, M) ||
7296
7293
P.parseToken (tok::at_sign, diag::expected_sil_value_name) ||
7297
7294
P.parseIdentifier (GlobalName, NameLoc, /* diagnoseDollarPrefix=*/ false ,
7298
7295
diag::expected_sil_value_name) ||
@@ -7344,7 +7341,7 @@ bool SILParserState::parseSILProperty(Parser &P) {
7344
7341
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7345
7342
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7346
7343
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7347
- nullptr , SP, M))
7344
+ nullptr , nullptr , SP, M))
7348
7345
return true ;
7349
7346
7350
7347
ValueDecl *VD;
@@ -7414,7 +7411,7 @@ bool SILParserState::parseSILVTable(Parser &P) {
7414
7411
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7415
7412
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7416
7413
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7417
- nullptr , VTableState, M))
7414
+ nullptr , nullptr , VTableState, M))
7418
7415
return true ;
7419
7416
7420
7417
// Parse the class name.
@@ -7525,7 +7522,7 @@ bool SILParserState::parseSILMoveOnlyDeinit(Parser &parser) {
7525
7522
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7526
7523
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7527
7524
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
7528
- nullptr , moveOnlyDeinitTableState, M))
7525
+ nullptr , nullptr , moveOnlyDeinitTableState, M))
7529
7526
return true ;
7530
7527
7531
7528
// Parse the class name.
@@ -8012,7 +8009,7 @@ bool SILParserState::parseSILWitnessTable(Parser &P) {
8012
8009
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
8013
8010
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
8014
8011
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
8015
- nullptr , WitnessState, M))
8012
+ nullptr , nullptr , WitnessState, M))
8016
8013
return true ;
8017
8014
8018
8015
// Parse the protocol conformance.
0 commit comments