From 0e2125b3854ea7c3cb3cde40de2e1b1ca3331c27 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Mon, 30 Mar 2026 13:27:52 +0100 Subject: [PATCH] =?UTF-8?q?Phase=201=20=E2=80=94=20Complete.=20The=20share?= =?UTF-8?q?d=20CFG=20library=20is=20now=20instantiated=20and=20wired=20int?= =?UTF-8?q?o=20Go:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created ControlFlowGraphShared.qll — contains the full GoCfg module with: Ast module implementing AstSig — 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. --- go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll index 77bb94d89f8..ebd8605c117 100644 --- a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll +++ b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll @@ -6,6 +6,7 @@ module; import go private import ControlFlowGraphImpl +private import ControlFlowGraphShared /** Provides helper predicates for mapping btween CFG nodes and the AST. */ module ControlFlow { @@ -359,3 +360,13 @@ module ControlFlow { class ControlFlowNode = ControlFlow::Node; class Write = ControlFlow::WriteNode; + +/** + * Provides the shared CFG library types for Go. + * + * These types are generated by the shared `codeql.controlflow.ControlFlowGraph` + * library and coexist with the existing Go CFG types during the transition. + * Use `SharedCfg::ControlFlowNode` to access the shared library's node type, + * `SharedCfg::ControlFlow::EntryNode` for entry nodes, etc. + */ +module SharedCfg = GoCfg;