|
4 | 4 |
|
5 | 5 | import go |
6 | 6 | private import ControlFlowGraphImpl |
| 7 | +private import codeql.controlflow.BasicBlock as BB |
| 8 | +private import codeql.controlflow.SuccessorType |
| 9 | + |
| 10 | +private module Input implements BB::InputSig<Location> { |
| 11 | + // /** Hold if `t` represents a conditional successor type. */ |
| 12 | + // predicate successorTypeIsCondition(SuccessorType t) { none() } |
| 13 | + /** A delineated part of the AST with its own CFG. */ |
| 14 | + class CfgScope = ControlFlow::Root; |
| 15 | + |
| 16 | + /** The class of control flow nodes. */ |
| 17 | + class Node = ControlFlowNode; |
| 18 | + |
| 19 | + /** Gets the CFG scope in which this node occurs. */ |
| 20 | + CfgScope nodeGetCfgScope(Node node) { node.getRoot() = result } |
| 21 | + |
| 22 | + /** Gets an immediate successor of this node. */ |
| 23 | + Node nodeGetASuccessor(Node node, SuccessorType t) { result = node.getASuccessor(t) } |
| 24 | + // /** |
| 25 | + // * Holds if `node` represents an entry node to be used when calculating |
| 26 | + // * dominance. |
| 27 | + // */ |
| 28 | + // predicate nodeIsDominanceEntry(Node node) { |
| 29 | + // exists(Stmt entrystmt | entrystmt = node.asStmt() | |
| 30 | + // exists(Callable c | entrystmt = c.getBody()) |
| 31 | + // or |
| 32 | + // // This disjunct is technically superfluous, but safeguards against extractor problems. |
| 33 | + // entrystmt instanceof BlockStmt and |
| 34 | + // not exists(entrystmt.getEnclosingCallable()) and |
| 35 | + // not entrystmt.getParent() instanceof Stmt |
| 36 | + // ) |
| 37 | + // } |
| 38 | + // /** |
| 39 | + // * Holds if `node` represents an exit node to be used when calculating |
| 40 | + // * post dominance. |
| 41 | + // */ |
| 42 | + // predicate nodeIsPostDominanceExit(Node node) { node instanceof ControlFlow::NormalExitNode } |
| 43 | +} |
| 44 | + |
| 45 | +private module BbImpl = BB::Make<Location, Input>; |
7 | 46 |
|
| 47 | +// import BbImpl |
8 | 48 | /** |
9 | 49 | * Holds if `nd` starts a new basic block. |
10 | 50 | */ |
|
0 commit comments