File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,15 @@ std::string LifetimeDependenceInfo::getString() const {
49
49
50
50
void LifetimeDependenceInfo::Profile (llvm::FoldingSetNodeID &ID) const {
51
51
if (inheritLifetimeParamIndices) {
52
+ // Copy and Consume are the same, can be unified if we converge on dependsOn
53
+ // syntax
54
+ ID.AddInteger ((uint8_t )LifetimeDependenceKind::Copy);
52
55
inheritLifetimeParamIndices->Profile (ID);
53
56
}
54
57
if (scopeLifetimeParamIndices) {
58
+ // Borrow and Mutate are the same, can be unified if we converge on
59
+ // dependsOn syntax
60
+ ID.AddInteger ((uint8_t )LifetimeDependenceKind::Borrow);
55
61
scopeLifetimeParamIndices->Profile (ID);
56
62
}
57
63
}
Original file line number Diff line number Diff line change @@ -102,3 +102,21 @@ struct Wrapper : ~Escapable {
102
102
return view
103
103
}
104
104
}
105
+
106
+ struct Container {
107
+ let ptr : UnsafeRawBufferPointer
108
+ init ( _ ptr: UnsafeRawBufferPointer ) {
109
+ self . ptr = ptr
110
+ }
111
+ }
112
+
113
+ // CHECK-LABEL: sil hidden @$s39explicit_lifetime_dependence_specifiers16getConsumingViewyAA06BufferG0VAA9ContainerVnF : $@convention(thin) (Container) -> _inherit(1) @owned BufferView {
114
+ func getConsumingView( _ x: consuming Container ) -> _consume( x ) BufferView {
115
+ return BufferView ( x. ptr)
116
+ }
117
+
118
+ // CHECK: sil hidden @$s39explicit_lifetime_dependence_specifiers16getBorrowingViewyAA06BufferG0VAA9ContainerVF : $@convention(thin) (Container) -> _scope(1) @owned BufferView {
119
+ func getBorrowingView( _ x: borrowing Container ) -> _borrow( x ) BufferView {
120
+ return BufferView ( x. ptr)
121
+ }
122
+
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func bv_copy(_ bv: borrowing BV) -> _copy(bv) BV {
20
20
21
21
// Diagnostics resolves mark_dependence [nonescaping].
22
22
//
23
- // CHECK-LABEL: sil hidden @$s4test14bv_borrow_copy0B0AA2BVVAE_tF : $@convention(thin) (@guaranteed BV) -> _inherit (1) @owned BV {
23
+ // CHECK-LABEL: sil hidden @$s4test14bv_borrow_copy0B0AA2BVVAE_tF : $@convention(thin) (@guaranteed BV) -> _scope (1) @owned BV {
24
24
// CHECK: bb0(%0 : @noImplicitCopy $BV):
25
25
// CHECK: [[R:%.*]] = apply %{{.*}}(%0) : $@convention(thin) (@guaranteed BV) -> _inherit(1) @owned BV
26
26
// CHECK: [[MD:%.*]] = mark_dependence [nonescaping] [[R]] : $BV on %0 : $BV
You can’t perform that action at this time.
0 commit comments