-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Shared: Add and use a signature for basic blocks #20253
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
base: main
Are you sure you want to change the base?
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 introduces a canonical BasicBlock signature for the shared library and refactors existing SSA and dataflow implementations to use it instead of duplicating BasicBlock API definitions.
Key changes:
- Introduces a canonical
CfgSig
signature in the shared controlflow library - Refactors SSA implementations across multiple languages to use the shared signature
- Updates Variable Capture modules to use the standardized interface
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
shared/ssa/codeql/ssa/Ssa.qll | Updates SSA implementation to use the new BasicBlock signature |
shared/dataflow/codeql/dataflow/VariableCapture.qll | Refactors variable capture to use the shared BasicBlock signature |
shared/controlflow/codeql/controlflow/BasicBlock.qll | Adds the canonical CfgSig signature interface |
swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll | Updates Swift dataflow to use shared BasicBlock interface |
swift/ql/lib/codeql/swift/dataflow/Ssa.qll | Refactors Swift SSA to use the new signature |
swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll | Implements the CfgSig signature for Swift |
Multiple language-specific files | Updates various language implementations to use the shared interface |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
@@ -1953,7 +1951,7 @@ | |||
* Holds if `(bb, i)` contains a write to an iterator that may have been obtained | |||
* by calling `begin` (or related functions) on the variable `v`. | |||
*/ | |||
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) { | |||
predicate variableWrite(IRCfg::BasicBlock bb, int i, SourceVariable v, boolean certain) { |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
final private class FinalBasicBlock = BasicBlock; | ||
|
||
module Cfg implements BB::CfgSig<DbLocation> { | ||
private import javascript as Js |
Check warning
Code scanning / CodeQL
Names only differing by case Warning
Js is only different by casing from JS that is used elsewhere for modules.
deprecated private predicate lastRefSkipUncertainReadsExt( | ||
Definition def, SsaInput::BasicBlock bb, int i | ||
) { | ||
deprecated private predicate lastRefSkipUncertainReadsExt(Definition def, BasicBlock bb, int i) { |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
this.hasValueBranchEdge(bb1, bb2, branch) | ||
} | ||
} | ||
|
||
/** Holds if the guard `guard` controls block `bb` upon evaluating to `branch`. */ | ||
predicate guardDirectlyControlsBlock(Guard guard, SsaInput::BasicBlock bb, GuardValue branch) { | ||
predicate guardDirectlyControlsBlock(Guard guard, BasicBlock bb, GuardValue branch) { |
Check warning
Code scanning / CodeQL
Dead code Warning
5230eb5
to
f8a1735
Compare
f8a1735
to
ab8a1b4
Compare
We already have a fairly canonical BasicBlock api in the shared library. This PR takes this one step further by canonicalizing that api in a signature and using it in mainly SSA and a few other places.