@@ -38,9 +38,8 @@ class SILResultInfo;
3838
3939enum class ParsedLifetimeDependenceKind : uint8_t {
4040 Default = 0 ,
41- Borrow,
42- Inherit, // Only used with deserialized decls
43- Inout
41+ Scope,
42+ Inherit // Only used with deserialized decls
4443};
4544
4645enum class LifetimeDependenceKind : uint8_t { Inherit = 0 , Scope };
@@ -183,7 +182,6 @@ class LifetimeEntry final
183182 ArrayRef<LifetimeDescriptor> sources,
184183 std::optional<LifetimeDescriptor> targetDescriptor = std::nullopt );
185184
186- std::string getString () const ;
187185 SourceLoc getLoc () const { return startLoc; }
188186 SourceLoc getStartLoc () const { return startLoc; }
189187 SourceLoc getEndLoc () const { return endLoc; }
@@ -195,6 +193,35 @@ class LifetimeEntry final
195193 std::optional<LifetimeDescriptor> getTargetDescriptor () const {
196194 return targetDescriptor;
197195 }
196+
197+ std::string getString () const {
198+ std::string result = " @lifetime(" ;
199+ if (targetDescriptor.has_value ()) {
200+ result += targetDescriptor->getString ();
201+ result += " : " ;
202+ }
203+
204+ bool firstElem = true ;
205+ for (auto source : getSources ()) {
206+ if (!firstElem) {
207+ result += " , " ;
208+ }
209+ switch (source.getParsedLifetimeDependenceKind ()) {
210+ case ParsedLifetimeDependenceKind::Scope:
211+ result += " borrow " ;
212+ break ;
213+ case ParsedLifetimeDependenceKind::Inherit:
214+ result += " copy " ;
215+ break ;
216+ default :
217+ break ;
218+ }
219+ result += source.getString ();
220+ firstElem = false ;
221+ }
222+ result += " )" ;
223+ return result;
224+ }
198225};
199226
200227class LifetimeDependenceInfo {
@@ -339,9 +366,6 @@ filterEscapableLifetimeDependencies(GenericSignature sig,
339366 SmallVectorImpl<LifetimeDependenceInfo> &outputs,
340367 llvm::function_ref<Type (unsigned targetIndex)> getSubstTargetType);
341368
342- StringRef
343- getNameForParsedLifetimeDependenceKind (ParsedLifetimeDependenceKind kind);
344-
345369} // namespace swift
346370
347371#endif
0 commit comments