File tree Expand file tree Collapse file tree 2 files changed +16
-33
lines changed
Expand file tree Collapse file tree 2 files changed +16
-33
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,26 @@ import java
1010import semmle.code.java.ControlFlowGraph
1111
1212/**
13- * Configuration for PrintCFG that outputs all CFG nodes and edges.
13+ * Holds if the node is an exit-related CFG node.
14+ * These nodes are excluded from the output because their ordering
15+ * is non-deterministic across CodeQL CLI versions.
16+ */
17+ private predicate isExitNode ( ControlFlow:: Node node ) {
18+ node .toString ( ) .matches ( "%Exit" )
19+ }
20+
21+ /**
22+ * Configuration for PrintCFG that outputs all CFG nodes and edges,
23+ * excluding exit nodes for deterministic output.
1424 */
1525query predicate nodes ( ControlFlow:: Node node , string property , string value ) {
1626 property = "semmle.label" and
17- value = node .toString ( )
27+ value = node .toString ( ) and
28+ not isExitNode ( node )
1829}
1930
2031query predicate edges ( ControlFlow:: Node pred , ControlFlow:: Node succ ) {
21- pred .getASuccessor ( ) = succ
32+ pred .getASuccessor ( ) = succ and
33+ not isExitNode ( pred ) and
34+ not isExitNode ( succ )
2235}
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ Example1.java:
33#-----| -> super(...)
44
55# 3| super(...)
6- #-----| -> Normal Exit
76
87# 5| { ... }
98#-----| -> if (...)
@@ -48,7 +47,6 @@ Example1.java:
4847#-----| -> 1
4948
5049# 20| return ...
51- #-----| -> Normal Exit
5250
5351# 23| { ... }
5452#-----| -> <Expr>;
@@ -60,19 +58,16 @@ Example1.java:
6058#-----| -> 0
6159
6260# 29| return ...
63- #-----| -> Normal Exit
6461
6562# 30| case ...
6663#-----| -> 1
6764
6865# 31| return ...
69- #-----| -> Normal Exit
7066
7167# 32| default
7268#-----| -> value
7369
7470# 33| return ...
75- #-----| -> Normal Exit
7671
7772# 6| ... > ...
7873#-----| -> { ... }
@@ -110,7 +105,6 @@ Example1.java:
110105
111106# 12| ... < ...
112107#-----| -> { ... }
113- #-----| -> Normal Exit
114108
115109# 12| ...++
116110#-----| -> i
@@ -190,27 +184,3 @@ Example1.java:
190184
191185# 33| 2
192186#-----| -> ... * ...
193-
194- # 3| Exceptional Exit
195- #-----| -> Exit
196-
197- # 3| Normal Exit
198- #-----| -> Exit
199-
200- # 5| Exceptional Exit
201- #-----| -> Exit
202-
203- # 5| Normal Exit
204- #-----| -> Exit
205-
206- # 18| Exceptional Exit
207- #-----| -> Exit
208-
209- # 18| Normal Exit
210- #-----| -> Exit
211-
212- # 3| Exit
213-
214- # 5| Exit
215-
216- # 18| Exit
You can’t perform that action at this time.
0 commit comments