Skip to content

Commit 6d66ea4

Browse files
committed
also deprecate the definitionReaches predicate, it was only used in a test
1 parent 5476008 commit 6d66ea4

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

javascript/ql/lib/semmle/javascript/DefUse.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,9 @@ class VarUse extends ControlFlowNode, @varref {
249249
/**
250250
* Holds if the definition of `v` in `def` reaches `use` along some control flow path
251251
* without crossing another definition of `v`.
252+
* DEPRECATED: Use the `SSA.qll` library instead.
252253
*/
253-
predicate definitionReaches(Variable v, VarDef def, VarUse use) {
254+
deprecated predicate definitionReaches(Variable v, VarDef def, VarUse use) {
254255
v = use.getVariable() and
255256
exists(BasicBlock bb, int i, int next | next = nextDefAfter(bb, v, i, def) |
256257
exists(int j | j in [i + 1 .. next - 1] | bb.useAt(j, v, use))
@@ -286,7 +287,7 @@ deprecated private SsaDefinition getAPseudoDefinitionInput(SsaDefinition nd) {
286287
* Holds if `d` is a definition of `v` at index `i` in `bb`, and the result is the next index
287288
* in `bb` after `i` at which the same variable is defined, or `bb.length()` if there is none.
288289
*/
289-
private int nextDefAfter(BasicBlock bb, Variable v, int i, VarDef d) {
290+
deprecated private int nextDefAfter(BasicBlock bb, Variable v, int i, VarDef d) {
290291
bb.defAt(i, v, d) and
291292
result =
292293
min(int jj |
Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
1-
| classes.js:1:1:2:1 | class Foo {\\n} | classes.js:4:1:4:3 | Foo |
2-
| classes.js:7:5:8:5 | class L ... {\\n } | classes.js:10:5:10:12 | LocalFoo |
3-
| es2015.js:1:10:1:11 | fn | es2015.js:2:3:2:4 | fn |
4-
| es2015.js:5:16:5:16 | i | es2015.js:5:32:5:32 | i |
5-
| es2015.js:5:16:5:16 | i | es2015.js:5:34:5:34 | i |
6-
| es2015modules.js:1:10:1:12 | foo | es2015modules.js:4:3:4:5 | foo |
7-
| es2015modules.js:1:15:1:24 | bar as baz | es2015modules.js:6:3:6:5 | baz |
8-
| es2015modules.js:10:10:10:13 | quux | es2015modules.js:7:3:7:6 | quux |
9-
| es2015modules.js:15:17:15:17 | f | es2015modules.js:12:1:12:1 | f |
10-
| es2015modules.js:16:25:16:25 | g | es2015modules.js:13:1:13:1 | g |
11-
| fundecls.js:3:12:3:12 | f | fundecls.js:4:3:4:3 | f |
12-
| fundecls.js:9:10:9:10 | s | fundecls.js:7:1:7:1 | s |
13-
| fundecls.js:12:12:12:12 | f | fundecls.js:10:3:10:3 | f |
14-
| fundecls.js:18:12:18:12 | f | fundecls.js:17:3:17:3 | f |
15-
| fundecls.js:23:12:23:12 | f | fundecls.js:24:3:24:3 | f |
16-
| fundecls.js:34:12:34:12 | f | fundecls.js:35:3:35:3 | f |
17-
| fundecls.js:39:11:39:11 | x | fundecls.js:40:7:40:7 | x |
18-
| fundecls.js:41:14:41:14 | f | fundecls.js:45:3:45:3 | f |
19-
| fundecls.js:43:14:43:14 | f | fundecls.js:45:3:45:3 | f |
20-
| fundecls.js:48:11:48:11 | x | fundecls.js:50:7:50:7 | x |
21-
| tst.js:1:12:1:12 | o | tst.js:3:12:3:12 | o |
22-
| tst.js:1:12:1:12 | o | tst.js:5:16:5:16 | o |
23-
| tst.js:2:9:2:14 | y = 23 | tst.js:8:17:8:17 | y |
24-
| tst.js:2:17:2:21 | i = 0 | tst.js:4:5:4:5 | i |
25-
| tst.js:2:17:2:21 | i = 0 | tst.js:7:6:7:6 | i |
26-
| tst.js:4:3:4:5 | ++i | tst.js:4:5:4:5 | i |
27-
| tst.js:4:3:4:5 | ++i | tst.js:7:6:7:6 | i |
28-
| tst.js:5:11:5:11 | z | tst.js:6:7:6:7 | z |
29-
| tst.js:5:11:5:11 | z | tst.js:8:14:8:14 | z |
30-
| tst.js:7:4:7:6 | --i | tst.js:7:6:7:6 | i |
31-
| tst.js:12:2:12:7 | x = 42 | tst.js:14:9:14:9 | x |
32-
| tst.js:19:11:19:11 | x | tst.js:18:9:18:9 | x |
33-
| tst.js:23:6:23:23 | {a = b, c = d} = e | tst.js:24:2:24:2 | a |
34-
| tst.js:23:6:23:23 | {a = b, c = d} = e | tst.js:24:6:24:6 | c |
35-
| tst.js:26:11:26:11 | a | tst.js:27:2:27:2 | a |
1+
| classes.js:7:5:8:5 | def@7:5 | classes.js:10:5:10:12 | LocalFoo |
2+
| es2015.js:1:10:1:11 | def@1:10 | es2015.js:2:3:2:4 | fn |
3+
| es2015.js:5:16:5:16 | def@5:16 | es2015.js:5:32:5:32 | i |
4+
| es2015.js:5:16:5:16 | def@5:16 | es2015.js:5:34:5:34 | i |
5+
| es2015modules.js:1:10:1:12 | def@1:10 | es2015modules.js:4:3:4:5 | foo |
6+
| es2015modules.js:1:15:1:24 | def@1:15 | es2015modules.js:6:3:6:5 | baz |
7+
| es2015modules.js:10:10:10:13 | def@10:10 | es2015modules.js:7:3:7:6 | quux |
8+
| es2015modules.js:15:17:15:17 | def@15:17 | es2015modules.js:12:1:12:1 | f |
9+
| es2015modules.js:16:25:16:25 | def@16:25 | es2015modules.js:13:1:13:1 | g |
10+
| fundecls.js:3:12:3:12 | def@3:12 | fundecls.js:4:3:4:3 | f |
11+
| fundecls.js:12:12:12:12 | def@12:12 | fundecls.js:10:3:10:3 | f |
12+
| fundecls.js:18:12:18:12 | def@18:12 | fundecls.js:17:3:17:3 | f |
13+
| fundecls.js:23:12:23:12 | def@23:12 | fundecls.js:24:3:24:3 | f |
14+
| fundecls.js:27:2:27:2 | implicitInit@27:2 | fundecls.js:28:3:28:3 | f |
15+
| fundecls.js:34:12:34:12 | def@34:12 | fundecls.js:35:3:35:3 | f |
16+
| fundecls.js:39:11:39:11 | def@39:11 | fundecls.js:40:7:40:7 | x |
17+
| fundecls.js:45:3:45:3 | phi@45:3 | fundecls.js:45:3:45:3 | f |
18+
| fundecls.js:48:11:48:11 | def@48:11 | fundecls.js:50:7:50:7 | x |
19+
| tst.js:1:12:1:12 | def@1:12 | tst.js:3:12:3:12 | o |
20+
| tst.js:1:12:1:12 | def@1:12 | tst.js:5:16:5:16 | o |
21+
| tst.js:2:9:2:14 | def@2:9 | tst.js:8:17:8:17 | y |
22+
| tst.js:3:2:3:2 | phi@3:2 | tst.js:4:5:4:5 | i |
23+
| tst.js:5:2:5:2 | phi@5:2 | tst.js:7:6:7:6 | i |
24+
| tst.js:5:2:5:2 | phi@5:2 | tst.js:8:14:8:14 | z |
25+
| tst.js:5:11:5:11 | def@5:11 | tst.js:6:7:6:7 | z |
26+
| tst.js:12:2:12:7 | def@12:2 | tst.js:14:9:14:9 | x |
27+
| tst.js:19:11:19:11 | def@19:11 | tst.js:18:9:18:9 | x |
28+
| tst.js:23:6:23:23 | def@23:6 | tst.js:24:2:24:2 | a |
29+
| tst.js:23:6:23:23 | def@23:6 | tst.js:24:6:24:6 | c |
30+
| tst.js:26:11:26:11 | def@26:11 | tst.js:27:2:27:2 | a |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import javascript
22

3-
from VarDef def, VarUse use
4-
where definitionReaches(_, def, use)
3+
from SsaVariable def, VarUse use
4+
where def.getAUse() = use
55
select def, use

0 commit comments

Comments
 (0)