Skip to content

Shared CFG: allow init stmts for IfStmt#21914

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:shared/cfg/if-init
Open

Shared CFG: allow init stmts for IfStmt#21914
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:shared/cfg/if-init

Conversation

@owen-mc
Copy link
Copy Markdown
Contributor

@owen-mc owen-mc commented May 30, 2026

Spun out from #21614.

@owen-mc
Copy link
Copy Markdown
Contributor Author

owen-mc commented Jun 1, 2026

Rerun has been triggered: 2 restarted 🚀

@owen-mc owen-mc marked this pull request as ready for review June 1, 2026 23:34
@owen-mc owen-mc requested a review from a team as a code owner June 1, 2026 23:34
Copilot AI review requested due to automatic review settings June 1, 2026 23:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the shared CFG library’s AST signature and successor construction to support languages with if statements that may include an initializer statement (evaluated before the condition), aligning shared CFG behavior with such frontends.

Changes:

  • Added a new AstSig hook getIfInit(IfStmt) (defaulting to none()).
  • Updated Make0 successor logic for IfStmt to route control flow through the init (when present) before evaluating the condition.
Show a summary per file
File Description
shared/controlflow/codeql/controlflow/ControlFlowGraph.qll Adds an IfStmt init hook and updates shared CFG successor relationships to incorporate init-before-condition flow.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Jun 2, 2026
Comment thread shared/controlflow/codeql/controlflow/ControlFlowGraph.qll Outdated
Co-authored-by: Tom Hvitved <hvitved@github.com>
@owen-mc owen-mc requested a review from hvitved June 2, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants