File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -186,15 +186,18 @@ void LifetimeDependenceInfo::Profile(llvm::FoldingSetNodeID &ID) const {
186
186
}
187
187
}
188
188
189
- // Warning: this is incorrect for Setter 'newValue' parameters. It should only
190
- // be called for a Setter's 'self'.
191
- static ValueOwnership getLoweredOwnership (AbstractFunctionDecl *afd) {
189
+ static ValueOwnership getLoweredOwnership (ParamDecl *param,
190
+ AbstractFunctionDecl *afd) {
192
191
if (isa<ConstructorDecl>(afd)) {
193
192
return ValueOwnership::Owned;
194
193
}
195
194
if (auto *ad = dyn_cast<AccessorDecl>(afd)) {
196
- if (ad->getAccessorKind () == AccessorKind::Set ||
197
- isYieldingMutableAccessor (ad->getAccessorKind ())) {
195
+ if (ad->getAccessorKind () == AccessorKind::Set) {
196
+ return param->isSelfParameter () ? ValueOwnership::InOut
197
+ : ValueOwnership::Owned;
198
+ }
199
+ if (isYieldingMutableAccessor (ad->getAccessorKind ())) {
200
+ assert (param->isSelfParameter ());
198
201
return ValueOwnership::InOut;
199
202
}
200
203
}
You can’t perform that action at this time.
0 commit comments