Skip to content

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Jan 27, 2026

Use the shared library to instantiate basic blocks. This leads to a small number of breaking changes to member predicate names, as detailed in the change note.

I wasn't sure if ReachableBasicBlock and ReachableJoinBlock are really needed any more. Their main purpose seems to have been to avoid unnecessary calculations in the dominance frontier calculation and some SSA calculations. I will leave them for now - I imagine they'll disappear when we adopt the shared SSA library at some point in the future.

@github-actions github-actions bot added the Go label Jan 27, 2026
@owen-mc owen-mc force-pushed the go/use-shared-basic-block-lib branch 2 times, most recently from 6fa0d2e to 497f350 Compare January 28, 2026 16:55
@owen-mc owen-mc force-pushed the go/use-shared-basic-block-lib branch from 497f350 to e1cf0a1 Compare January 28, 2026 22:14
@owen-mc owen-mc marked this pull request as ready for review January 28, 2026 22:19
Copilot AI review requested due to automatic review settings January 28, 2026 22:19
@owen-mc owen-mc requested a review from a team as a code owner January 28, 2026 22:19
@owen-mc owen-mc requested a review from a team January 28, 2026 22:20
Copy link
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

This pull request refactors the Go language's basic block implementation to use a shared basic blocks library from the CodeQL standard library, resulting in cleaner code and better consistency across languages.

Changes:

  • Migrated BasicBlock class implementation from custom code to the shared codeql.controlflow.BasicBlock library
  • Updated API across the codebase: renamed getRoot() to getScope(), added successor type parameters to getAPredecessor() and getASuccessor(), and replaced inDominanceFrontierOf() with inDominanceFrontier() with swapped arguments
  • Added supporting infrastructure including the ControlFlowNode type alias and getOutcome() method for ConditionGuardNode

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/ql/lib/semmle/go/controlflow/BasicBlocks.qll Replaced custom basic block implementation with shared library integration through Input module and BbImpl instantiation
go/ql/lib/semmle/go/dataflow/SsaImpl.qll Updated API calls: getRoot() to getScope(), added _ parameter to successor/predecessor calls, and swapped inDominanceFrontierOf() arguments
go/ql/lib/semmle/go/dataflow/SSA.qll Updated getRoot() to getScope() and added _ parameter to getAPredecessor()
go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll Added getOutcome() method to ConditionGuardNode and ControlFlowNode type alias to support shared library integration
go/ql/src/Security/CWE-020/IncompleteHostnameRegexp.ql Updated getAPredecessor() call to include _ parameter
go/ql/lib/qlpack.yml Added dependency on codeql/controlflow library
go/ql/lib/change-notes/2026-01-28-shared-basic-block-library.md Documented breaking changes from this refactoring

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@owen-mc
Copy link
Contributor Author

owen-mc commented Jan 29, 2026

DCA doesn't show any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant