File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -1228,13 +1228,30 @@ UnresolvedSpecializeExpr *UnresolvedSpecializeExpr::create(ASTContext &ctx,
1228
1228
}
1229
1229
1230
1230
bool CaptureListEntry::isSimpleSelfCapture () const {
1231
+ auto &ctx = Var->getASTContext ();
1232
+
1233
+ if (Var->getName () != ctx.Id_self )
1234
+ return false ;
1235
+
1236
+ if (auto *attr = Var->getAttrs ().getAttribute <ReferenceOwnershipAttr>())
1237
+ if (attr->get () == ReferenceOwnership::Weak)
1238
+ return false ;
1239
+
1231
1240
if (Init->getPatternList ().size () != 1 )
1232
1241
return false ;
1233
- if (auto *DRE = dyn_cast<DeclRefExpr>(Init->getInit (0 )))
1242
+
1243
+ auto *expr = Init->getInit (0 );
1244
+
1245
+ if (auto *DRE = dyn_cast<DeclRefExpr>(expr)) {
1234
1246
if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl ())) {
1235
- return (VD->isSelfParameter () || VD->isSelfParamCapture ())
1236
- && VD->getName () == Var->getName ();
1247
+ return VD->getName () == ctx.Id_self ;
1237
1248
}
1249
+ }
1250
+
1251
+ if (auto *UDRE = dyn_cast<UnresolvedDeclRefExpr>(expr)) {
1252
+ return UDRE->getName ().isSimpleName (ctx.Id_self );
1253
+ }
1254
+
1238
1255
return false ;
1239
1256
}
1240
1257
You can’t perform that action at this time.
0 commit comments