File tree Expand file tree Collapse file tree 3 files changed +52
-11
lines changed Expand file tree Collapse file tree 3 files changed +52
-11
lines changed Original file line number Diff line number Diff line change @@ -141,17 +141,7 @@ struct LifetimeDescriptor {
141141 return getName ().str () == " immortal" ;
142142 }
143143
144- std::string getString () const {
145- switch (kind) {
146- case DescriptorKind::Named:
147- return getName ().str ().str ();
148- case DescriptorKind::Ordered:
149- return std::to_string (getIndex ());
150- case DescriptorKind::Self:
151- return " self" ;
152- }
153- llvm_unreachable (" Invalid DescriptorKind" );
154- }
144+ std::string getString () const ;
155145};
156146
157147class LifetimeEntry final
Original file line number Diff line number Diff line change 2828
2929namespace swift {
3030
31+ std::string LifetimeDescriptor::getString () const {
32+ switch (kind) {
33+ case DescriptorKind::Named:
34+ return getName ().str ().str ();
35+ case DescriptorKind::Ordered:
36+ return std::to_string (getIndex ());
37+ case DescriptorKind::Self:
38+ return " self" ;
39+ }
40+ llvm_unreachable (" Invalid DescriptorKind" );
41+ }
42+
3143LifetimeEntry *
3244LifetimeEntry::create (const ASTContext &ctx, SourceLoc startLoc,
3345 SourceLoc endLoc, ArrayRef<LifetimeDescriptor> sources,
Original file line number Diff line number Diff line change 1+ // REQUIRES: swift_feature_Lifetimes
2+ // REQUIRES: swift_feature_LifetimeDependence
3+
4+ // RUN: %empty-directory(%t)
5+ // RUN: split-file %s %t
6+
7+ // RUN: %target-swift-ide-test -enable-experimental-feature Lifetimes -enable-experimental-feature LifetimeDependence -print-swift-file-interface -source-filename %t/test.swift > %t/interface.txt
8+ // RUN: diff %t/interface.txt %t/interface.txt.expected
9+
10+ //--- test.swift
11+ public struct S : ~ Escapable {
12+ @_lifetime ( immortal)
13+ init ( ) { }
14+ }
15+
16+ @_lifetime ( foo: copy foo)
17+ public func fooFunc( _ foo: inout S ) { }
18+
19+ @_lifetime ( & bar)
20+ public func barFunc( _ bar: inout S ) -> S {
21+ return bar
22+ }
23+
24+ @_lifetime ( `func`: copy `func`)
25+ public func funcFunc( func: inout S ) { }
26+
27+ //--- interface.txt.expected
28+
29+ public struct S : ~ Escapable {
30+
31+ @_lifetime ( immortal)
32+ internal init ( )
33+ }
34+ @_lifetime ( foo: copy foo)
35+ public func fooFunc( _ foo: inout S )
36+ @_lifetime ( & bar)
37+ public func barFunc( _ bar: inout S ) -> S
38+ @_lifetime ( func: copy func )
39+ public func func Func( func: inout S )
You can’t perform that action at this time.
0 commit comments