@@ -3433,7 +3433,14 @@ class AnyFunctionType : public TypeBase {
3433
3433
Type getGlobalActor () const ;
3434
3434
Type getThrownError () const ;
3435
3435
3436
- LifetimeDependenceInfo getLifetimeDependenceInfo () const ;
3436
+ const LifetimeDependenceInfo *getLifetimeDependenceInfoOrNull () const ;
3437
+
3438
+ LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3439
+ if (auto *depInfo = getLifetimeDependenceInfoOrNull ()) {
3440
+ return *depInfo;
3441
+ }
3442
+ return LifetimeDependenceInfo ();
3443
+ }
3437
3444
3438
3445
FunctionTypeIsolation getIsolation () const {
3439
3446
if (hasExtInfo ())
@@ -3765,14 +3772,19 @@ class FunctionType final
3765
3772
return getTrailingObjects<Type>()[hasGlobalActor ()];
3766
3773
}
3767
3774
3768
- LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3769
- if (! hasLifetimeDependenceInfo ()) {
3770
- return LifetimeDependenceInfo () ;
3775
+ inline LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3776
+ if (auto *depInfo = getLifetimeDependenceInfoOrNull ()) {
3777
+ return *depInfo ;
3771
3778
}
3779
+ return LifetimeDependenceInfo ();
3780
+ }
3781
+
3782
+ // / Returns nullptr for an empty dependence list.
3783
+ const LifetimeDependenceInfo *getLifetimeDependenceInfoOrNull () const {
3772
3784
auto *info = getTrailingObjects<LifetimeDependenceInfo>();
3773
3785
assert (!info->empty () && " If the LifetimeDependenceInfo was empty, we "
3774
3786
" shouldn't have stored it." );
3775
- return * info;
3787
+ return info;
3776
3788
}
3777
3789
3778
3790
void Profile (llvm::FoldingSetNodeID &ID) {
@@ -3914,14 +3926,19 @@ class GenericFunctionType final
3914
3926
return getTrailingObjects<Type>()[hasGlobalActor ()];
3915
3927
}
3916
3928
3917
- LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3918
- if (! hasLifetimeDependenceInfo ()) {
3919
- return LifetimeDependenceInfo () ;
3929
+ inline LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3930
+ if (auto *depInfo = getLifetimeDependenceInfoOrNull ()) {
3931
+ return *depInfo ;
3920
3932
}
3933
+ return LifetimeDependenceInfo ();
3934
+ }
3935
+
3936
+ // / Returns nullptr for an empty dependence list.
3937
+ const LifetimeDependenceInfo *getLifetimeDependenceInfoOrNull () const {
3921
3938
auto *info = getTrailingObjects<LifetimeDependenceInfo>();
3922
3939
assert (!info->empty () && " If the LifetimeDependenceInfo was empty, we "
3923
3940
" shouldn't have stored it." );
3924
- return * info;
3941
+ return info;
3925
3942
}
3926
3943
3927
3944
// / Retrieve the generic signature of this function type.
0 commit comments