mirror of
https://github.com/github/codeql.git
synced 2026-05-14 03:09:26 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user