Skip to content

Commit 052792f

Browse files
committed
Use location of stmt for EvalImplicitTrueInstruction
1 parent 90ea10e commit 052792f

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

go/ql/lib/semmle/go/controlflow/IR.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,9 +1229,7 @@ module IR {
12291229
override predicate hasLocationInfo(
12301230
string filepath, int startline, int startcolumn, int endline, int endcolumn
12311231
) {
1232-
stmt.hasLocationInfo(filepath, startline, startcolumn, _, _) and
1233-
endline = startline and
1234-
endcolumn = startcolumn
1232+
stmt.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
12351233
}
12361234
}
12371235

go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.expected

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
| DuplicateSwitchCase.go:3:1:12:1 | function declaration | DuplicateSwitchCase.go:14:6:14:10 | skip |
44
| DuplicateSwitchCase.go:3:6:3:15 | skip | DuplicateSwitchCase.go:3:1:12:1 | function declaration |
55
| DuplicateSwitchCase.go:3:17:3:19 | argument corresponding to msg | DuplicateSwitchCase.go:3:17:3:19 | initialization of msg |
6-
| DuplicateSwitchCase.go:3:17:3:19 | initialization of msg | DuplicateSwitchCase.go:4:2:4:2 | true |
7-
| DuplicateSwitchCase.go:4:2:4:2 | true | DuplicateSwitchCase.go:5:7:5:9 | msg |
6+
| DuplicateSwitchCase.go:3:17:3:19 | initialization of msg | DuplicateSwitchCase.go:4:2:11:2 | true |
7+
| DuplicateSwitchCase.go:4:2:11:2 | true | DuplicateSwitchCase.go:5:7:5:9 | msg |
88
| DuplicateSwitchCase.go:5:7:5:9 | msg | DuplicateSwitchCase.go:5:14:5:20 | "start" |
99
| DuplicateSwitchCase.go:5:7:5:20 | ...==... | DuplicateSwitchCase.go:5:7:5:20 | case ...==... |
1010
| DuplicateSwitchCase.go:5:7:5:20 | ...==... is false | DuplicateSwitchCase.go:7:7:7:9 | msg |
@@ -1356,13 +1356,13 @@
13561356
| stmts.go:95:3:95:7 | test5 | stmts.go:95:9:95:12 | true |
13571357
| stmts.go:95:9:95:12 | true | stmts.go:95:3:95:13 | call to test5 |
13581358
| stmts.go:98:9:98:9 | x | stmts.go:100:7:100:7 | 2 |
1359-
| stmts.go:99:2:99:9 | skip | stmts.go:104:2:104:2 | true |
1359+
| stmts.go:99:2:99:9 | skip | stmts.go:104:2:108:2 | true |
13601360
| stmts.go:100:7:100:7 | 2 | stmts.go:100:7:100:7 | case 2 |
13611361
| stmts.go:100:7:100:7 | case 2 | stmts.go:99:2:99:9 | skip |
13621362
| stmts.go:100:7:100:7 | case 2 | stmts.go:101:3:101:7 | test5 |
13631363
| stmts.go:101:3:101:7 | test5 | stmts.go:101:9:101:12 | true |
13641364
| stmts.go:101:9:101:12 | true | stmts.go:101:3:101:13 | call to test5 |
1365-
| stmts.go:104:2:104:2 | true | stmts.go:107:7:107:10 | true |
1365+
| stmts.go:104:2:108:2 | true | stmts.go:107:7:107:10 | true |
13661366
| stmts.go:107:7:107:10 | case true | stmts.go:107:7:107:10 | true is false |
13671367
| stmts.go:107:7:107:10 | case true | stmts.go:107:7:107:10 | true is true |
13681368
| stmts.go:107:7:107:10 | true | stmts.go:107:7:107:10 | case true |
@@ -1479,8 +1479,8 @@
14791479
| tst.go:3:1:12:1 | function declaration | tst.go:14:6:14:11 | skip |
14801480
| tst.go:3:6:3:10 | skip | tst.go:3:1:12:1 | function declaration |
14811481
| tst.go:3:12:3:12 | argument corresponding to x | tst.go:3:12:3:12 | initialization of x |
1482-
| tst.go:3:12:3:12 | initialization of x | tst.go:4:2:4:2 | true |
1483-
| tst.go:4:2:4:2 | true | tst.go:5:7:5:7 | x |
1482+
| tst.go:3:12:3:12 | initialization of x | tst.go:4:2:11:2 | true |
1483+
| tst.go:4:2:11:2 | true | tst.go:5:7:5:7 | x |
14841484
| tst.go:5:2:5:13 | skip | tst.go:3:1:12:1 | exit |
14851485
| tst.go:5:7:5:7 | x | tst.go:5:11:5:12 | 23 |
14861486
| tst.go:5:7:5:12 | ...<... | tst.go:5:7:5:12 | case ...<... |
@@ -1509,8 +1509,8 @@
15091509
| tst.go:14:1:21:1 | function declaration | tst.go:23:6:23:11 | skip |
15101510
| tst.go:14:6:14:11 | skip | tst.go:14:1:21:1 | function declaration |
15111511
| tst.go:14:13:14:17 | argument corresponding to value | tst.go:14:13:14:17 | initialization of value |
1512-
| tst.go:14:13:14:17 | initialization of value | tst.go:15:2:15:2 | true |
1513-
| tst.go:15:2:15:2 | true | tst.go:16:7:16:11 | value |
1512+
| tst.go:14:13:14:17 | initialization of value | tst.go:15:2:20:2 | true |
1513+
| tst.go:15:2:20:2 | true | tst.go:16:7:16:11 | value |
15141514
| tst.go:16:2:16:34 | skip | tst.go:14:1:21:1 | exit |
15151515
| tst.go:16:7:16:11 | value | tst.go:16:15:16:33 | ...*... |
15161516
| tst.go:16:7:16:33 | ...<... | tst.go:16:7:16:33 | case ...<... |
@@ -1527,12 +1527,12 @@
15271527
| tst.go:18:7:18:38 | case ...<... | tst.go:18:7:18:38 | ...<... is false |
15281528
| tst.go:18:7:18:38 | case ...<... | tst.go:18:7:18:38 | ...<... is true |
15291529
| tst.go:18:15:18:38 | ...*... | tst.go:18:7:18:38 | ...<... |
1530-
| tst.go:23:1:26:1 | entry | tst.go:24:2:24:2 | true |
1530+
| tst.go:23:1:26:1 | entry | tst.go:24:2:25:2 | true |
15311531
| tst.go:23:1:26:1 | function declaration | tst.go:28:6:28:11 | skip |
15321532
| tst.go:23:6:23:11 | skip | tst.go:23:1:26:1 | function declaration |
1533-
| tst.go:24:2:24:2 | true | tst.go:23:1:26:1 | exit |
1534-
| tst.go:28:1:32:1 | entry | tst.go:29:2:29:2 | true |
1533+
| tst.go:24:2:25:2 | true | tst.go:23:1:26:1 | exit |
1534+
| tst.go:28:1:32:1 | entry | tst.go:29:2:31:2 | true |
15351535
| tst.go:28:1:32:1 | function declaration | tst.go:0:0:0:0 | exit |
15361536
| tst.go:28:6:28:11 | skip | tst.go:28:1:32:1 | function declaration |
1537-
| tst.go:29:2:29:2 | true | tst.go:30:2:30:9 | skip |
1537+
| tst.go:29:2:31:2 | true | tst.go:30:2:30:9 | skip |
15381538
| tst.go:30:2:30:9 | skip | tst.go:28:1:32:1 | exit |

0 commit comments

Comments
 (0)