Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions java/ql/test/library-tests/guards12/guard.expected
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ hasBranchEdge
| Test.java:11:7:11:17 | case ... | Test.java:11:7:11:17 | case ... | Test.java:12:7:12:17 | case ... | false |
| Test.java:12:7:12:17 | case ... | Test.java:12:7:12:17 | case ... | Test.java:12:12:12:14 | "d" | true |
| Test.java:12:7:12:17 | case ... | Test.java:12:7:12:17 | case ... | Test.java:13:7:13:16 | default | false |
| Test.java:17:7:17:36 | case <Pattern> | Test.java:15:5:15:25 | var ...; | Test.java:17:7:17:36 | After case <Pattern> [no-match] | false |
| Test.java:17:7:17:36 | case <Pattern> | Test.java:15:5:15:25 | var ...; | Test.java:17:19:17:19 | <anonymous local variable> | true |
| Test.java:17:7:17:36 | case <Pattern> | Test.java:15:5:15:25 | var ...; | Test.java:18:7:18:17 | case ... | false |
| Test.java:17:26:17:33 | ... == ... | Test.java:17:19:17:19 | <anonymous local variable> | Test.java:17:26:17:33 | After ... == ... [false] | false |
| Test.java:17:26:17:33 | ... == ... | Test.java:17:19:17:19 | <anonymous local variable> | Test.java:17:38:17:40 | { ... } | true |
| Test.java:18:7:18:17 | case ... | Test.java:18:7:18:17 | case ... | Test.java:18:12:18:14 | "e" | true |
Expand All @@ -21,16 +21,16 @@ hasBranchEdge
| Test.java:21:13:21:19 | unknown | Test.java:21:5:21:42 | switch (...) | Test.java:21:27:21:27 | s | false |
| Test.java:22:7:22:17 | case ... | Test.java:22:7:22:17 | case ... | Test.java:22:12:22:14 | "f" | true |
| Test.java:22:7:22:17 | case ... | Test.java:22:7:22:17 | case ... | Test.java:23:7:23:37 | case <Pattern> | false |
| Test.java:23:7:23:37 | case <Pattern> | Test.java:23:7:23:37 | case <Pattern> | Test.java:23:7:23:37 | After case <Pattern> [no-match] | false |
| Test.java:23:7:23:37 | case <Pattern> | Test.java:23:7:23:37 | case <Pattern> | Test.java:23:19:23:20 | s2 | true |
| Test.java:23:7:23:37 | case <Pattern> | Test.java:23:7:23:37 | case <Pattern> | Test.java:24:7:24:17 | case ... | false |
| Test.java:23:27:23:34 | ... == ... | Test.java:23:19:23:20 | s2 | Test.java:23:27:23:34 | After ... == ... [false] | false |
| Test.java:23:27:23:34 | ... == ... | Test.java:23:19:23:20 | s2 | Test.java:23:39:23:41 | { ... } | true |
| Test.java:24:7:24:17 | case ... | Test.java:24:7:24:17 | case ... | Test.java:24:12:24:14 | "g" | true |
| Test.java:24:7:24:17 | case ... | Test.java:24:7:24:17 | case ... | Test.java:25:7:25:16 | default | false |
| Test.java:28:7:28:15 | case ... | Test.java:27:5:27:14 | switch (...) | Test.java:28:12:28:14 | "h" | true |
| Test.java:28:7:28:15 | case ... | Test.java:27:5:27:14 | switch (...) | Test.java:29:7:29:34 | case <Pattern> | false |
| Test.java:29:7:29:34 | case <Pattern> | Test.java:29:7:29:34 | case <Pattern> | Test.java:29:7:29:34 | After case <Pattern> [no-match] | false |
| Test.java:29:7:29:34 | case <Pattern> | Test.java:29:7:29:34 | case <Pattern> | Test.java:29:19:29:19 | <anonymous local variable> | true |
| Test.java:29:7:29:34 | case <Pattern> | Test.java:29:7:29:34 | case <Pattern> | Test.java:30:7:30:15 | case ... | false |
| Test.java:29:26:29:33 | ... == ... | Test.java:29:19:29:19 | <anonymous local variable> | Test.java:29:26:29:33 | After ... == ... [false] | false |
| Test.java:29:26:29:33 | ... == ... | Test.java:29:19:29:19 | <anonymous local variable> | Test.java:29:26:29:33 | After ... == ... [true] | true |
| Test.java:30:7:30:15 | case ... | Test.java:30:7:30:15 | case ... | Test.java:30:12:30:14 | "i" | true |
Expand All @@ -52,6 +52,7 @@ hasBranchEdge
| Test.java:17:26:17:33 | ... == ... | Test.java:17:26:17:28 | len | Test.java:17:33:17:33 | 4 | true | true | Test.java:17:38:17:40 | { ... } |
| Test.java:18:7:18:17 | case ... | Test.java:16:13:16:13 | s | Test.java:18:12:18:14 | "e" | true | false | Test.java:19:7:19:16 | default |
| Test.java:18:7:18:17 | case ... | Test.java:16:13:16:13 | s | Test.java:18:12:18:14 | "e" | true | true | Test.java:18:12:18:14 | "e" |
| Test.java:22:7:22:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:22:12:22:14 | "f" | true | false | Test.java:23:7:23:37 | After case <Pattern> [no-match] |
| Test.java:22:7:22:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:22:12:22:14 | "f" | true | false | Test.java:23:7:23:37 | case <Pattern> |
| Test.java:22:7:22:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:22:12:22:14 | "f" | true | false | Test.java:23:19:23:20 | s2 |
| Test.java:22:7:22:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:22:12:22:14 | "f" | true | false | Test.java:23:27:23:34 | After ... == ... [false] |
Expand All @@ -64,6 +65,7 @@ hasBranchEdge
| Test.java:23:27:23:34 | ... == ... | Test.java:23:27:23:29 | len | Test.java:23:34:23:34 | 4 | true | true | Test.java:23:39:23:41 | { ... } |
| Test.java:24:7:24:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:24:12:24:14 | "g" | true | false | Test.java:25:7:25:16 | default |
| Test.java:24:7:24:17 | case ... | Test.java:21:13:21:41 | ...?...:... | Test.java:24:12:24:14 | "g" | true | true | Test.java:24:12:24:14 | "g" |
| Test.java:28:7:28:15 | case ... | Test.java:27:13:27:13 | s | Test.java:28:12:28:14 | "h" | true | false | Test.java:29:7:29:34 | After case <Pattern> [no-match] |
| Test.java:28:7:28:15 | case ... | Test.java:27:13:27:13 | s | Test.java:28:12:28:14 | "h" | true | false | Test.java:29:7:29:34 | case <Pattern> |
| Test.java:28:7:28:15 | case ... | Test.java:27:13:27:13 | s | Test.java:28:12:28:14 | "h" | true | false | Test.java:29:19:29:19 | <anonymous local variable> |
| Test.java:28:7:28:15 | case ... | Test.java:27:13:27:13 | s | Test.java:28:12:28:14 | "h" | true | false | Test.java:29:26:29:33 | After ... == ... [false] |
Expand Down
34 changes: 7 additions & 27 deletions shared/controlflow/codeql/controlflow/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1200,28 +1200,6 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
n2.isAfterValue(boollit, any(BooleanSuccessor t | t.getValue() = boollit.getValue()))
)
or
exists(ExprStmt exprstmt |
n1.isBefore(exprstmt) and
n2.isBefore(exprstmt.getExpr())
// the `isAfter(exprstmt.getExpr())` to `isAfter(exprstmt)` case is handled by `propagatesValue` above.
)
or
exists(BlockStmt blockstmt |
n1.isBefore(blockstmt) and
n2.isBefore(blockstmt.getStmt(0))
or
not exists(blockstmt.getStmt(_)) and
n1.isBefore(blockstmt) and
n2.isAfter(blockstmt) and
not simpleLeafNode(blockstmt)
or
exists(int i |
n1.isAfter(blockstmt.getStmt(i)) and
n2.isBefore(blockstmt.getStmt(i + 1))
)
// the `isAfter(blockstmt.getLastStmt())` to `isAfter(blockstmt)` case is handled by `propagatesValue` above.
)
or
exists(IfStmt ifstmt |
n1.isBefore(ifstmt) and
n2.isBefore(ifstmt.getCondition())
Expand Down Expand Up @@ -1434,6 +1412,8 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
exists(int i |
n1.isAfterValue(getRankedCaseCfgOrder(switch, i),
any(MatchingSuccessor t | t.getValue() = false))
or
n1.isAfterFalse(getRankedCaseCfgOrder(switch, i).getGuard())
|
n2.isBefore(getRankedCaseCfgOrder(switch, i + 1))
or
Expand Down Expand Up @@ -1478,9 +1458,6 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
or
n1.isAfterTrue(case.getGuard()) and
n2 = beforeBody
or
n1.isAfterFalse(case.getGuard()) and
n2.isAfterValue(case, any(MatchingSuccessor t | t.getValue() = false))
)
)
or
Expand Down Expand Up @@ -1525,8 +1502,11 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
(
n1.isBefore(ast) and not exists(getRankedChild(ast, _)) and not simpleLeafNode(ast)
or
exists(int i |
n1.isAfter(getRankedChild(ast, i)) and not exists(getRankedChild(ast, i + 1))
exists(int i, AstNode last |
last = getRankedChild(ast, i) and
not exists(getRankedChild(ast, i + 1)) and
n1.isAfter(last) and
not propagatesValue(last, ast)
)
) and
(if postOrInOrder(ast) then n2.isIn(ast) else n2.isAfter(ast))
Expand Down
Loading