Files
codeql/cpp/ql/test/library-tests/controlflow/controlflow/SsaDefUsePairs.expected
Jonas Jensen 367776511f C++: Don't use dbtypes in ControlFlowNode etc.
Many classes have been declared with `extends @cfgnode` because they
should be implemented internally as a control-flow node but should not
expose the member predicates of `ControlFlowNode` to their users. After
the transition in a1e44041e it became mandatory to convert explicitly
between the `Element`-derived `ControlFlowNode` and the raw dbtype
`@cfgnode`, and that commit inserted numerous such conversions as a
result of having all those classes that did not derive from `Element` in
the standard library.

It was also confusing and error-prone that the libraries implementing
`ControlFlowNode` referred to `ControlFlowNode`. This seemingly cyclic
reference worked out because the libraries did not call the predicates
on `ControlFlowNode` whose implementation they were part of.

Both these problems are now solved by adding a new class
`ControlFlowNodeBase extends Element` that should be used in preference
to `@cfgnode` everywhere. This class is for exactly those use cases
where `@cfgnode` should be seen as an `Element` without having too many
member predicates on it.

The classes that move from extending `@cfgnode` to extending
`ControlFlowNodeBase` are: `BasicBlock`, `AdditionalControlFlowEdge`,
`DefOrUse`, `SsaDefinition`, `SubBasicBlock` and `RangeSsaDefinition`.
These previously had to define their own `toString` rootdef, which
typically had some dummy string as result (like `"BasicBlock"`), but now
their `toString` is part of the `Element` rootdef and should not be
overridden otherwise `Element.toString` will sometimes have multiple
results. Removing these dummy `toString` predicates had some effects on
the tests that are included in this commit.

The `getLocation` family of predicates is affected like `toString`, but
the situation is slightly different. Some of these classes had genuinely
useful alternative definitions of locations. Fortunately, they all used
`hasLocationInfo`, which is preferred over `getLocation` by the QL
engine. Because `Element` does not define `getLocationInfo`, each class
can create its own rootdef of this predicate like before.
2018-08-28 14:27:32 +02:00

90 lines
6.6 KiB
Plaintext

| pass_by_ref.cpp:9:19:28:1 | { ... } | SSA def(n) | pass_by_ref.cpp:18:12:18:12 | n |
| pass_by_ref.cpp:9:19:28:1 | { ... } | SSA def(n) | pass_by_ref.cpp:21:12:21:12 | n |
| pass_by_ref.cpp:12:18:12:35 | uninitializedArray | SSA def(uninitializedArray) | pass_by_ref.cpp:13:20:13:37 | uninitializedArray |
| pass_by_ref.cpp:13:20:13:37 | uninitializedArray | SSA def(uninitializedArray) | pass_by_ref.cpp:15:23:15:40 | uninitializedArray |
| pass_by_ref.cpp:13:20:13:37 | uninitializedArray | SSA def(uninitializedArray) | pass_by_ref.cpp:16:25:16:42 | uninitializedArray |
| pass_by_ref.cpp:13:20:13:37 | uninitializedArray | SSA def(uninitializedArray) | pass_by_ref.cpp:27:10:27:27 | uninitializedArray |
| pass_by_ref.cpp:18:12:18:12 | n | SSA def(i1) | pass_by_ref.cpp:19:22:19:23 | i1 |
| pass_by_ref.cpp:19:22:19:23 | i1 | SSA def(i1) | pass_by_ref.cpp:27:34:27:35 | i1 |
| pass_by_ref.cpp:21:12:21:12 | n | SSA def(i2) | pass_by_ref.cpp:22:21:22:22 | i2 |
| pass_by_ref.cpp:22:20:22:22 | & ... | SSA def(i2) | pass_by_ref.cpp:24:26:24:27 | i2 |
| pass_by_ref.cpp:22:20:22:22 | & ... | SSA def(i2) | pass_by_ref.cpp:25:27:25:28 | i2 |
| pass_by_ref.cpp:22:20:22:22 | & ... | SSA def(i2) | pass_by_ref.cpp:27:39:27:40 | i2 |
| pass_by_ref.cpp:32:12:32:12 | n | SSA phi(arr) | pass_by_ref.cpp:33:20:33:22 | arr |
| pass_by_ref.cpp:32:12:32:12 | n | SSA phi(n) | pass_by_ref.cpp:32:12:32:12 | n |
| pass_by_ref.cpp:39:12:39:12 | n | SSA phi(arr) | pass_by_ref.cpp:40:22:40:24 | arr |
| pass_by_ref.cpp:39:12:39:12 | n | SSA phi(n) | pass_by_ref.cpp:39:12:39:12 | n |
| pass_by_ref.cpp:40:22:40:24 | arr | SSA def(arr) | pass_by_ref.cpp:41:20:41:22 | arr |
| pass_by_ref.cpp:45:20:55:1 | { ... } | SSA def(n) | pass_by_ref.cpp:46:11:46:11 | n |
| pass_by_ref.cpp:45:20:55:1 | { ... } | SSA def(n) | pass_by_ref.cpp:48:7:48:7 | n |
| pass_by_ref.cpp:46:11:46:11 | n | SSA def(i) | pass_by_ref.cpp:49:5:49:5 | i |
| pass_by_ref.cpp:53:3:53:24 | ExprStmt | SSA phi(i) | pass_by_ref.cpp:53:22:53:22 | i |
| pass_by_ref.cpp:53:22:53:22 | i | SSA def(i) | pass_by_ref.cpp:54:10:54:10 | i |
| test.c:2:31:72:1 | { ... } | SSA def(x) | test.c:7:9:7:9 | x |
| test.c:2:31:72:1 | { ... } | SSA def(x) | test.c:14:9:14:9 | x |
| test.c:2:31:72:1 | { ... } | SSA def(x) | test.c:17:8:17:8 | x |
| test.c:2:31:72:1 | { ... } | SSA def(x) | test.c:26:9:26:9 | x |
| test.c:2:31:72:1 | { ... } | SSA def(x) | test.c:31:10:31:10 | x |
| test.c:14:5:14:13 | ... = ... | SSA def(z) | test.c:20:16:20:16 | z |
| test.c:14:5:14:14 | ExprStmt | SSA phi(y) | test.c:14:13:14:13 | y |
| test.c:31:5:31:10 | ... += ... | SSA def(z) | test.c:39:5:39:5 | z |
| test.c:31:5:31:11 | ExprStmt | SSA phi(z) | test.c:31:5:31:5 | z |
| test.c:34:11:34:11 | x | SSA phi(x) | test.c:34:11:34:11 | x |
| test.c:34:11:34:11 | x | SSA phi(x) | test.c:36:9:36:9 | x |
| test.c:34:11:34:11 | x | SSA phi(y) | test.c:39:10:39:10 | y |
| test.c:39:5:39:10 | ... += ... | SSA def(z) | test.c:47:5:47:5 | z |
| test.c:42:16:42:16 | j | SSA phi(j) | test.c:42:16:42:16 | j |
| test.c:42:16:42:16 | j | SSA phi(j) | test.c:42:24:42:24 | j |
| test.c:42:16:42:16 | j | SSA phi(w) | test.c:47:10:47:10 | w |
| test.c:47:5:47:10 | ... += ... | SSA def(z) | test.c:52:12:52:12 | z |
| test.c:47:5:47:10 | ... += ... | SSA def(z) | test.c:66:5:66:5 | z |
| test.c:50:16:50:16 | j | SSA phi(j) | test.c:50:16:50:16 | j |
| test.c:50:16:50:16 | j | SSA phi(j) | test.c:50:24:50:24 | j |
| test.c:50:16:50:16 | j | SSA phi(x) | test.c:66:10:66:10 | x |
| test.c:51:9:51:14 | ... = ... | SSA def(y) | test.c:53:16:53:16 | y |
| test.c:64:5:64:5 | label ...: | SSA phi(w) | test.c:66:18:66:18 | w |
| test.c:64:5:64:5 | label ...: | SSA phi(y) | test.c:66:14:66:14 | y |
| test.c:70:5:70:10 | ... = ... | SSA def(w) | test.c:71:12:71:12 | w |
| test.c:74:19:89:1 | { ... } | SSA def(a) | test.c:79:13:79:13 | a |
| test.c:74:19:89:1 | { ... } | SSA def(a) | test.c:83:13:83:13 | a |
| test.c:74:19:89:1 | { ... } | SSA def(a) | test.c:85:13:85:13 | a |
| test.c:80:13:80:18 | ... = ... | SSA def(c) | test.c:81:17:81:17 | c |
| test.c:83:9:84:18 | if (...) ... | SSA phi(b) | test.c:88:12:88:12 | b |
| test.c:83:9:84:18 | if (...) ... | SSA phi(c) | test.c:86:20:86:20 | c |
| test.c:91:33:97:1 | { ... } | SSA def(cond) | test.c:93:9:93:12 | cond |
| test.c:96:5:96:11 | ExprStmt | SSA phi(x) | test.c:96:9:96:9 | x |
| test.cpp:2:19:17:1 | { ... } | SSA def(p) | test.cpp:3:11:3:11 | p |
| test.cpp:2:19:17:1 | { ... } | SSA def(p) | test.cpp:5:13:5:13 | p |
| test.cpp:5:13:5:13 | p | SSA def(r0) | test.cpp:16:10:16:11 | r0 |
| test.cpp:6:13:6:13 | x | SSA def(r1) | test.cpp:7:13:7:14 | r1 |
| test.cpp:6:13:6:13 | x | SSA def(r1) | test.cpp:13:7:13:8 | r1 |
| test.cpp:6:13:6:13 | x | SSA def(r1) | test.cpp:16:15:16:16 | r1 |
| test.cpp:7:13:7:14 | r1 | SSA def(r2) | test.cpp:8:13:8:14 | r2 |
| test.cpp:7:13:7:14 | r1 | SSA def(r2) | test.cpp:10:5:10:6 | r2 |
| test.cpp:7:13:7:14 | r1 | SSA def(r2) | test.cpp:16:20:16:21 | r2 |
| test.cpp:8:12:8:14 | & ... | SSA def(q) | test.cpp:11:6:11:6 | q |
| test.cpp:8:12:8:14 | & ... | SSA def(q) | test.cpp:11:11:11:11 | q |
| test.cpp:8:12:8:14 | & ... | SSA def(q) | test.cpp:16:26:16:26 | q |
| test.cpp:9:19:9:19 | i | SSA phi(i) | test.cpp:9:19:9:19 | i |
| test.cpp:9:19:9:19 | i | SSA phi(i) | test.cpp:9:27:9:27 | i |
| test.cpp:9:19:9:19 | i | SSA phi(i) | test.cpp:12:9:12:9 | i |
| test.cpp:19:27:21:1 | { ... } | SSA def(x) | test.cpp:20:3:20:3 | x |
| test.cpp:23:27:25:1 | { ... } | SSA def(x) | test.cpp:24:5:24:5 | x |
| test.cpp:33:10:33:11 | 1 | SSA def(x) | test.cpp:35:19:35:19 | x |
| test.cpp:33:10:33:11 | 1 | SSA def(x) | test.cpp:36:19:36:19 | x |
| test.cpp:33:10:33:11 | 1 | SSA def(x) | test.cpp:37:22:37:22 | x |
| test.cpp:33:10:33:11 | 1 | SSA def(x) | test.cpp:41:16:41:16 | x |
| test.cpp:34:10:34:11 | 2 | SSA def(y) | test.cpp:38:20:38:20 | y |
| test.cpp:34:10:34:11 | 2 | SSA def(y) | test.cpp:39:20:39:20 | y |
| test.cpp:34:10:34:11 | 2 | SSA def(y) | test.cpp:40:23:40:23 | y |
| test.cpp:35:19:35:19 | x | SSA def(r1) | test.cpp:43:14:43:15 | r1 |
| test.cpp:36:19:36:19 | x | SSA def(r2) | test.cpp:43:19:43:20 | r2 |
| test.cpp:37:22:37:22 | x | SSA def(r3) | test.cpp:43:24:43:25 | r3 |
| test.cpp:38:19:38:20 | & ... | SSA def(p1) | test.cpp:43:30:43:31 | p1 |
| test.cpp:39:19:39:20 | & ... | SSA def(p2) | test.cpp:43:36:43:37 | p2 |
| test.cpp:40:22:40:23 | & ... | SSA def(p3) | test.cpp:43:42:43:43 | p3 |
| test.cpp:41:16:41:16 | x | SSA def(x) | test.cpp:42:17:42:17 | x |
| test.cpp:42:16:42:17 | & ... | SSA def(x) | test.cpp:43:10:43:10 | x |
| test.cpp:47:10:47:11 | 1 | SSA def(x) | test.cpp:48:27:48:27 | x |
| test.cpp:47:10:47:11 | 1 | SSA def(x) | test.cpp:49:10:49:10 | x |