We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fe79fa commit 3f96125Copy full SHA for 3f96125
lib/AST/Expr.cpp
@@ -1968,8 +1968,15 @@ bool ClosureExpr::hasEmptyBody() const {
1968
}
1969
1970
bool ClosureExpr::capturesSelfEnablingImplictSelf() const {
1971
- if (auto *VD = getCapturedSelfDecl())
1972
- return VD->isSelfParamCapture() && !VD->getType()->is<WeakStorageType>();
+ if (auto *VD = getCapturedSelfDecl()) {
+ if (!VD->isSelfParamCapture())
1973
+ return false;
1974
+
1975
+ if (auto *attr = VD->getAttrs().getAttribute<ReferenceOwnershipAttr>())
1976
+ return attr->get() != ReferenceOwnership::Weak;
1977
1978
+ return true;
1979
+ }
1980
return false;
1981
1982
0 commit comments