Skip to content

Commit e3ac376

Browse files
committed
Refactor 'getASuccessor' to edges/3
This interface works better when defining the DFG edges in the next commit
1 parent 0a6b25d commit e3ac376

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

shared/controlflow/codeql/controlflow/Cfg.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,10 +1324,10 @@ module MakeWithSplitting<
13241324
string getOrderDisambiguation() { result = "" }
13251325
}
13261326

1327-
Node getASuccessor(Node n, string s) {
1327+
predicate edge(Node node1, string label, Node node2) {
13281328
exists(SuccessorType t |
1329-
result = n.getASuccessor(t) and
1330-
if t instanceof DirectSuccessor then s = "" else s = t.toString()
1329+
node2 = node1.getASuccessor(t) and
1330+
if t instanceof DirectSuccessor then label = "" else label = t.toString()
13311331
)
13321332
}
13331333
}

shared/util/codeql/util/PrintGraph.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ signature module InputSig<LocationSig Location> {
2323
string getOrderDisambiguation();
2424
}
2525

26-
Node getASuccessor(Node n, string label);
26+
predicate edge(Node node1, string label, Node node2);
2727
}
2828

2929
/** Provides modules for printing flow graphs. */
@@ -40,7 +40,7 @@ module PrintGraph<LocationSig Location, InputSig<Location> Input> {
4040
module TestOutput<RelevantNodeSig RelevantNode> {
4141
/** Holds if `pred -> succ` is an edge in the graph. */
4242
query predicate edges(RelevantNode pred, RelevantNode succ, string label) {
43-
label = strictconcat(string s | succ = getASuccessor(pred, s) | s, ", " order by s)
43+
label = strictconcat(string s | edge(pred, s, succ) | s, ", " order by s)
4444
}
4545

4646
/**

0 commit comments

Comments
 (0)