-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Ruby: More captured exit read nodes #19483
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the liveness analysis for captured variables to include exceptional exits and adds tests to verify this behavior.
- Remove the
bb.isNormal()
guard in thecapturedExitRead
predicate to cover exception-driven exits - Add
do_twice
/retry_once
helpers and corresponding tests (get_done_twice
,get_retried
) - Document the new exceptional-exit semantics in a change note
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
ruby/ql/test/query-tests/variables/DeadStoreOfLocal/DeadStoreOfLocal.rb | Added do_twice and retry_once helpers and tests to ensure blocks run twice or on retry |
ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll | Removed the bb.isNormal() guard in capturedExitRead to include exception exits |
ruby/ql/lib/change-notes/2025-05-13-captured-variables-live-more-often.md | Added a note on captured variables remaining live on exceptional exit |
Comments suppressed due to low confidence (1)
ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll:106
- Update the doc comment above this predicate to mention that captured variables are also considered live on exceptional exits (not just normal exits).
private predicate capturedExitRead(Cfg::AnnotatedExitBasicBlock bb, int i, LocalVariable v) {
ruby/ql/test/query-tests/variables/DeadStoreOfLocal/DeadStoreOfLocal.rb
Outdated
Show resolved
Hide resolved
ruby/ql/lib/change-notes/2025-05-13-captured-variables-live-more-often.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Some stage timings increase, but overall everything is slightly faster. And we remove several false positives :-) |
No description provided.