File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -591,6 +591,10 @@ class AccessedStorage {
591591 return getKind () == Class;
592592 }
593593
594+ // / Return true if this storage is valid for all uses in a function without
595+ // / checking its lifetime.
596+ bool isGuaranteedForFunction () const ;
597+
594598 // / Returns the ValueDecl for the underlying storage, if it can be
595599 // / determined. Otherwise returns null.
596600 // /
Original file line number Diff line number Diff line change @@ -570,6 +570,17 @@ void AccessedStorage::visitRoots(
570570 }
571571}
572572
573+ bool AccessedStorage::isGuaranteedForFunction () const {
574+ if (getKind () == AccessedStorage::Argument) {
575+ return getArgument ()->getArgumentConvention ().isGuaranteedConvention ();
576+ }
577+ if (isObjectAccess ()) {
578+ return getRoot ().getOwnershipKind () == OwnershipKind::Guaranteed
579+ && isa<SILFunctionArgument>(getRoot ());
580+ }
581+ return false ;
582+ }
583+
573584// Set 'isLet' to true if this storage can be determined to be a 'let' variable.
574585//
575586// \p base must be the access base for this storage, as passed to the
You can’t perform that action at this time.
0 commit comments