@@ -3866,10 +3866,11 @@ std::string getParamListAsString(ArrayRef<AnyFunctionType::Param> parameters);
38663866// / on those parameters and dependent member types thereof. The input and
38673867// / output types of the generic function can be expressed in terms of those
38683868// / generic parameters.
3869- class GenericFunctionType final : public AnyFunctionType,
3870- public llvm::FoldingSetNode,
3871- private llvm::TrailingObjects<GenericFunctionType, AnyFunctionType::Param,
3872- Type> {
3869+ class GenericFunctionType final
3870+ : public AnyFunctionType,
3871+ public llvm::FoldingSetNode,
3872+ private llvm::TrailingObjects<GenericFunctionType, AnyFunctionType::Param,
3873+ Type, LifetimeDependenceInfo> {
38733874 friend TrailingObjects;
38743875
38753876 GenericSignature Signature;
@@ -3882,6 +3883,10 @@ class GenericFunctionType final : public AnyFunctionType,
38823883 return hasGlobalActor () + hasThrownError ();
38833884 }
38843885
3886+ size_t numTrailingObjects (OverloadToken<LifetimeDependenceInfo>) const {
3887+ return hasLifetimeDependenceInfo () ? 1 : 0 ;
3888+ }
3889+
38853890 // / Construct a new generic function type.
38863891 GenericFunctionType (GenericSignature sig, ArrayRef<Param> params, Type result,
38873892 llvm::Optional<ExtInfo> info, const ASTContext *ctx,
@@ -3909,7 +3914,17 @@ class GenericFunctionType final : public AnyFunctionType,
39093914 return Type ();
39103915 return getTrailingObjects<Type>()[hasGlobalActor ()];
39113916 }
3912-
3917+
3918+ LifetimeDependenceInfo getLifetimeDependenceInfo () const {
3919+ if (!hasLifetimeDependenceInfo ()) {
3920+ return LifetimeDependenceInfo ();
3921+ }
3922+ auto *info = getTrailingObjects<LifetimeDependenceInfo>();
3923+ assert (!info->empty () && " If the LifetimeDependenceInfo was empty, we "
3924+ " shouldn't have stored it." );
3925+ return *info;
3926+ }
3927+
39133928 // / Retrieve the generic signature of this function type.
39143929 GenericSignature getGenericSignature () const {
39153930 return Signature;
0 commit comments