@@ -38,9 +38,8 @@ class SILResultInfo;
38
38
39
39
enum class ParsedLifetimeDependenceKind : uint8_t {
40
40
Default = 0 ,
41
- Borrow,
42
- Inherit, // Only used with deserialized decls
43
- Inout
41
+ Scope,
42
+ Inherit // Only used with deserialized decls
44
43
};
45
44
46
45
enum class LifetimeDependenceKind : uint8_t { Inherit = 0 , Scope };
@@ -183,7 +182,6 @@ class LifetimeEntry final
183
182
ArrayRef<LifetimeDescriptor> sources,
184
183
std::optional<LifetimeDescriptor> targetDescriptor = std::nullopt );
185
184
186
- std::string getString () const ;
187
185
SourceLoc getLoc () const { return startLoc; }
188
186
SourceLoc getStartLoc () const { return startLoc; }
189
187
SourceLoc getEndLoc () const { return endLoc; }
@@ -195,6 +193,35 @@ class LifetimeEntry final
195
193
std::optional<LifetimeDescriptor> getTargetDescriptor () const {
196
194
return targetDescriptor;
197
195
}
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
+ }
198
225
};
199
226
200
227
class LifetimeDependenceInfo {
@@ -339,9 +366,6 @@ filterEscapableLifetimeDependencies(GenericSignature sig,
339
366
SmallVectorImpl<LifetimeDependenceInfo> &outputs,
340
367
llvm::function_ref<Type (unsigned targetIndex)> getSubstTargetType);
341
368
342
- StringRef
343
- getNameForParsedLifetimeDependenceKind (ParsedLifetimeDependenceKind kind);
344
-
345
369
} // namespace swift
346
370
347
371
#endif
0 commit comments