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 {
591
591
return getKind () == Class;
592
592
}
593
593
594
+ // / Return true if this storage is valid for all uses in a function without
595
+ // / checking its lifetime.
596
+ bool isGuaranteedForFunction () const ;
597
+
594
598
// / Returns the ValueDecl for the underlying storage, if it can be
595
599
// / determined. Otherwise returns null.
596
600
// /
Original file line number Diff line number Diff line change @@ -570,6 +570,17 @@ void AccessedStorage::visitRoots(
570
570
}
571
571
}
572
572
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
+
573
584
// Set 'isLet' to true if this storage can be determined to be a 'let' variable.
574
585
//
575
586
// \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