Skip to content

Commit 03245a5

Browse files
committed
Phase 1 — Complete. The shared CFG library is now instantiated and wired into Go:
Created ControlFlowGraphShared.qll — contains the full GoCfg module with: Ast module implementing AstSig<Location> — maps Go's AST types to the shared interface, with empty types for constructs Go doesn't have (while/do/try/catch/throw/ternary/null-coalescing) Input module implementing InputSig1 + InputSig2 — labels, conditional contexts, custom step() predicates for if-with-init, for/range loops, expression/type switches, case clauses, select, defer, and go statements; abrupt completions for panics, fallthrough, and goto Make0/Make1/Make2 wiring and import Public Modified ControlFlowGraph.qll — added import of the shared library and re-exports it as module SharedCfg = GoCfg, making shared types accessible as SharedCfg::ControlFlowNode, SharedCfg::ControlFlow::EntryNode, SharedCfg::BasicBlock, etc. No breakage — all 90 src queries and library files compile cleanly.
1 parent 93dff09 commit 03245a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module;
66

77
import go
88
private import ControlFlowGraphImpl
9+
private import ControlFlowGraphShared
910

1011
/** Provides helper predicates for mapping btween CFG nodes and the AST. */
1112
module ControlFlow {
@@ -359,3 +360,13 @@ module ControlFlow {
359360
class ControlFlowNode = ControlFlow::Node;
360361

361362
class Write = ControlFlow::WriteNode;
363+
364+
/**
365+
* Provides the shared CFG library types for Go.
366+
*
367+
* These types are generated by the shared `codeql.controlflow.ControlFlowGraph`
368+
* library and coexist with the existing Go CFG types during the transition.
369+
* Use `SharedCfg::ControlFlowNode` to access the shared library's node type,
370+
* `SharedCfg::ControlFlow::EntryNode` for entry nodes, etc.
371+
*/
372+
module SharedCfg = GoCfg;

0 commit comments

Comments
 (0)