-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-1807] Sema should catch and warn about self capture in closures #44416
Comments
Comment by Paul Meng (JIRA) I am interested into working on this one. It would be great to give some guidances on status quo on self retain cycle detection. I started by searching the keyword `ARC and found `ARCAnalysis.cpp`, but it looks the functions inside are not referenced from outside and mostly work on `SILInstruction`, and it looks like currently there is nothing comparable to the `findRetainCycleOwner` or `checkRetainCycles` from `/clang/lib/Sema/SemaChecking.cpp`. Therefore I don't think `ARCAnalysis.cpp` is the way to go. then I tried to `ag` in the directory to find something sound like `retain`, `cycle` etc but I am unlucky and couldn't find anything. so the questions are
Thanks! |
PaulMeng (JIRA User) So sorry it took me so long to get to this. I've started a branch with something that handles quite a few cases already if you'd like to pick it up and carry it over the goal line. |
Comment by Paul Meng (JIRA) CodaFi (JIRA User) Neat! Thanks for laying the ground work for newbie here. I briefly checked your branch and I think it is quite complete. probably what are left are test cases before carrying it over the goal line? I don't think there is a spec for this, I could compare it against clang's Sema code http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?revision=290146&view=markup ti check if there is any critical cases left. |
Comment by Paul Meng (JIRA) It seems that it would report false alarm on this snippet. I am trying to propose a fix for that. init(name: String) { ``` |
PaulMeng (JIRA User) are you still working on this? I wouldn't mind picking it up. |
Resetting assignee on all Starter Bugs not modified since 2018. |
Additional Detail from JIRA
md5: 3ea294e377274fa3d27e3c3b76ff7bbd
Issue Description:
To maintain parity with Objective-C, we should use our ARC analysis pass in Sema to check for the presence of self capture in blocks without weak or
@noescape
. This should be a very simple warning modeled after the one in/clang/lib/Sema/SemaChecking.cpp
void diagnoseRetainCycle()
.The text was updated successfully, but these errors were encountered: