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 {
4949
5050void LifetimeDependenceInfo::Profile (llvm::FoldingSetNodeID &ID) const {
5151 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);
5255 inheritLifetimeParamIndices->Profile (ID);
5356 }
5457 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);
5561 scopeLifetimeParamIndices->Profile (ID);
5662 }
5763}
Original file line number Diff line number Diff line change @@ -102,3 +102,21 @@ struct Wrapper : ~Escapable {
102102 return view
103103 }
104104}
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 {
2020
2121// Diagnostics resolves mark_dependence [nonescaping].
2222//
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 {
2424// CHECK: bb0(%0 : @noImplicitCopy $BV):
2525// CHECK: [[R:%.*]] = apply %{{.*}}(%0) : $@convention(thin) (@guaranteed BV) -> _inherit(1) @owned BV
2626// CHECK: [[MD:%.*]] = mark_dependence [nonescaping] [[R]] : $BV on %0 : $BV
You can’t perform that action at this time.
0 commit comments