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 {
186186 }
187187}
188188
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) {
192191 if (isa<ConstructorDecl>(afd)) {
193192 return ValueOwnership::Owned;
194193 }
195194 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 ());
198201 return ValueOwnership::InOut;
199202 }
200203 }
You can’t perform that action at this time.
0 commit comments