Skip to content

Unified: CFG tweaks - #22615

Merged
aschackmull merged 3 commits into
github:mainfrom
aschackmull:unified/cfg-tweaks
Sep 18, 2026
Merged

aschackmull merged 3 commits into
github:mainfrom
aschackmull:unified/cfg-tweaks

Conversation

@aschackmull

Copy link
Copy Markdown
Contributor

3 individual commits with 3 small improvements:

  • Drop operators from the CFG: We e.g. obviously want an addition in the CFG but not the + token itself.
  • Support capture declarations - they evaluated in the surrounding scope.
  • Support Swift GuardIfStmt

@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Sep 18, 2026
Copilot AI balanced review requested due to automatic review settings September 18, 2026 08:15
@aschackmull
aschackmull requested a review from a team as a code owner September 18, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused implementation matches the intended CFG semantics and is covered by updated tests.

Review effort: Balanced
Findings: None

What changed in this PR

Improves Unified Swift CFG accuracy for operators, closure captures, and guard statements.

Changes:

  • Excludes operator tokens from CFG traversal.
  • Evaluates closure capture declarations in the surrounding scope.
  • Models Swift guard statements and updates CFG tests.
File Description
unified/​ql/​lib/​codeql/​unified/​internal/​ControlFlowGraph.qll Implements CFG behavior changes.
unified/​ql/​test/​library-tests/​controlflow/​cfg.swift Adds and updates inline CFG assertions.
unified/​ql/​test/​library-tests/​controlflow/​cfg.expected Updates generated CFG expectations.
unified/​ql/​test/​library-tests/​controlflow/​basicblock-slices.expected Updates generated basic-block expectations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@hvitved hvitved left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@aschackmull
aschackmull merged commit e80686c into github:main Sep 18, 2026
15 checks passed
@aschackmull
aschackmull deleted the unified/cfg-tweaks branch September 18, 2026 08:27
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.

4 participants