Skip to content

Commit e5f419c

Browse files
committed
Shared: Define getNode inside cached module
1 parent 9a4bf75 commit e5f419c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

shared/controlflow/codeql/controlflow/BasicBlock.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
8989
BasicBlock getAPredecessor(SuccessorType t) { result.getASuccessor(t) = this }
9090

9191
/** Gets the control flow node at a specific (zero-indexed) position in this basic block. */
92-
Node getNode(int pos) { bbIndex(this.getFirstNode(), result, pos) }
92+
Node getNode(int pos) { result = getNode(this, pos) }
9393

9494
/** Gets a control flow node in this basic block. */
9595
Node getANode() { result = this.getNode(_) }
@@ -308,10 +308,12 @@ module Make<LocationSig Location, InputSig<Location> Input> {
308308
* Holds if `bbStart` is the first node in a basic block and `cfn` is the
309309
* `i`th node in the same basic block.
310310
*/
311-
cached
312-
predicate bbIndex(Node bbStart, Node cfn, int i) =
311+
private predicate bbIndex(Node bbStart, Node cfn, int i) =
313312
shortestDistances(startsBB/1, intraBBSucc/2)(bbStart, cfn, i)
314313

314+
cached
315+
Node getNode(BasicBlock bb, int pos) { bbIndex(bb.getFirstNode(), result, pos) }
316+
315317
/**
316318
* Holds if the first node of basic block `succ` is a control flow
317319
* successor of the last node of basic block `pred`.

0 commit comments

Comments
 (0)