Skip to content

Commit d91dfb7

Browse files
committed
C++: Added getAnExpr test
1 parent 2cc4bdd commit d91dfb7

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
| test.cpp:5:3:5:13 | ... = ... | test.cpp:5:3:5:13 | ... = ... |
2+
| test.cpp:6:3:6:13 | ... = ... | test.cpp:6:3:6:13 | ... = ... |
3+
| test.cpp:7:3:7:7 | ... = ... | test.cpp:7:3:7:7 | ... = ... |
4+
| test.cpp:10:16:10:16 | 1 | test.cpp:10:16:10:16 | 1 |
5+
| test.cpp:16:3:16:24 | ... = ... | test.cpp:16:3:16:24 | ... = ... |
6+
| test.cpp:16:7:16:24 | ... + ... | test.cpp:17:7:17:24 | ... + ... |
7+
| test.cpp:16:7:16:24 | ... + ... | test.cpp:18:7:18:7 | x |
8+
| test.cpp:16:17:16:24 | global01 | test.cpp:17:17:17:24 | global01 |
9+
| test.cpp:17:3:17:24 | ... = ... | test.cpp:17:3:17:24 | ... = ... |
10+
| test.cpp:17:7:17:24 | ... + ... | test.cpp:16:7:16:24 | ... + ... |
11+
| test.cpp:17:17:17:24 | global01 | test.cpp:16:17:16:24 | global01 |
12+
| test.cpp:18:3:18:7 | ... = ... | test.cpp:18:3:18:7 | ... = ... |
13+
| test.cpp:18:7:18:7 | x | test.cpp:16:7:16:24 | ... + ... |
14+
| test.cpp:21:16:21:16 | 2 | test.cpp:21:16:21:16 | 2 |
15+
| test.cpp:29:3:29:24 | ... = ... | test.cpp:29:3:29:24 | ... = ... |
16+
| test.cpp:30:3:30:17 | call to change_global02 | test.cpp:30:3:30:17 | call to change_global02 |
17+
| test.cpp:31:3:31:24 | ... = ... | test.cpp:31:3:31:24 | ... = ... |
18+
| test.cpp:32:3:32:7 | ... = ... | test.cpp:32:3:32:7 | ... = ... |
19+
| test.cpp:35:16:35:16 | 3 | test.cpp:35:16:35:16 | 3 |
20+
| test.cpp:43:3:43:24 | ... = ... | test.cpp:43:3:43:24 | ... = ... |
21+
| test.cpp:44:3:44:9 | ... = ... | test.cpp:44:3:44:9 | ... = ... |
22+
| test.cpp:44:9:44:9 | 0 | test.cpp:51:25:51:25 | 0 |
23+
| test.cpp:44:9:44:9 | 0 | test.cpp:53:18:53:21 | (int)... |
24+
| test.cpp:44:9:44:9 | 0 | test.cpp:56:39:56:42 | (int)... |
25+
| test.cpp:44:9:44:9 | 0 | test.cpp:59:17:59:20 | (int)... |
26+
| test.cpp:44:9:44:9 | 0 | test.cpp:88:12:88:12 | 0 |
27+
| test.cpp:45:3:45:24 | ... = ... | test.cpp:45:3:45:24 | ... = ... |
28+
| test.cpp:46:3:46:7 | ... = ... | test.cpp:46:3:46:7 | ... = ... |
29+
| test.cpp:51:25:51:25 | 0 | test.cpp:44:9:44:9 | 0 |
30+
| test.cpp:51:25:51:25 | 0 | test.cpp:53:18:53:21 | (int)... |
31+
| test.cpp:51:25:51:25 | 0 | test.cpp:56:39:56:42 | (int)... |
32+
| test.cpp:51:25:51:25 | 0 | test.cpp:59:17:59:20 | (int)... |
33+
| test.cpp:51:25:51:25 | 0 | test.cpp:88:12:88:12 | 0 |
34+
| test.cpp:51:25:51:25 | (unsigned int)... | test.cpp:51:25:51:25 | (unsigned int)... |
35+
| test.cpp:53:10:53:13 | (int)... | test.cpp:53:10:53:13 | (int)... |
36+
| test.cpp:53:10:53:13 | (int)... | test.cpp:56:21:56:24 | (int)... |
37+
| test.cpp:53:10:53:13 | * ... | test.cpp:56:21:56:24 | * ... |
38+
| test.cpp:53:18:53:21 | (int)... | test.cpp:44:9:44:9 | 0 |
39+
| test.cpp:53:18:53:21 | (int)... | test.cpp:51:25:51:25 | 0 |
40+
| test.cpp:53:18:53:21 | (int)... | test.cpp:53:18:53:21 | (int)... |
41+
| test.cpp:53:18:53:21 | (int)... | test.cpp:56:39:56:42 | (int)... |
42+
| test.cpp:53:18:53:21 | (int)... | test.cpp:59:17:59:20 | (int)... |
43+
| test.cpp:53:18:53:21 | (int)... | test.cpp:88:12:88:12 | 0 |
44+
| test.cpp:55:5:55:15 | ... = ... | test.cpp:55:5:55:15 | ... = ... |
45+
| test.cpp:56:12:56:25 | (...) | test.cpp:56:12:56:25 | (...) |
46+
| test.cpp:56:12:56:43 | ... && ... | test.cpp:56:12:56:43 | ... && ... |
47+
| test.cpp:56:13:56:16 | (int)... | test.cpp:56:13:56:16 | (int)... |
48+
| test.cpp:56:13:56:16 | (int)... | test.cpp:56:31:56:34 | (int)... |
49+
| test.cpp:56:13:56:16 | (int)... | test.cpp:59:9:59:12 | (int)... |
50+
| test.cpp:56:13:56:16 | * ... | test.cpp:56:31:56:34 | * ... |
51+
| test.cpp:56:13:56:16 | * ... | test.cpp:59:9:59:12 | * ... |
52+
| test.cpp:56:14:56:16 | ptr | test.cpp:56:47:56:49 | ptr |
53+
| test.cpp:56:21:56:24 | (int)... | test.cpp:53:10:53:13 | (int)... |
54+
| test.cpp:56:21:56:24 | (int)... | test.cpp:56:21:56:24 | (int)... |
55+
| test.cpp:56:21:56:24 | * ... | test.cpp:53:10:53:13 | * ... |
56+
| test.cpp:56:30:56:43 | (...) | test.cpp:56:30:56:43 | (...) |
57+
| test.cpp:56:31:56:34 | (int)... | test.cpp:56:13:56:16 | (int)... |
58+
| test.cpp:56:31:56:34 | (int)... | test.cpp:56:31:56:34 | (int)... |
59+
| test.cpp:56:31:56:34 | (int)... | test.cpp:59:9:59:12 | (int)... |
60+
| test.cpp:56:31:56:34 | * ... | test.cpp:56:13:56:16 | * ... |
61+
| test.cpp:56:31:56:34 | * ... | test.cpp:59:9:59:12 | * ... |
62+
| test.cpp:56:32:56:34 | ptr | test.cpp:56:47:56:49 | ptr |
63+
| test.cpp:56:39:56:42 | (int)... | test.cpp:44:9:44:9 | 0 |
64+
| test.cpp:56:39:56:42 | (int)... | test.cpp:51:25:51:25 | 0 |
65+
| test.cpp:56:39:56:42 | (int)... | test.cpp:53:18:53:21 | (int)... |
66+
| test.cpp:56:39:56:42 | (int)... | test.cpp:56:39:56:42 | (int)... |
67+
| test.cpp:56:39:56:42 | (int)... | test.cpp:59:17:59:20 | (int)... |
68+
| test.cpp:56:39:56:42 | (int)... | test.cpp:88:12:88:12 | 0 |
69+
| test.cpp:56:47:56:49 | ptr | test.cpp:56:14:56:16 | ptr |
70+
| test.cpp:56:47:56:49 | ptr | test.cpp:56:32:56:34 | ptr |
71+
| test.cpp:56:47:56:49 | ptr | test.cpp:59:10:59:12 | ptr |
72+
| test.cpp:59:9:59:12 | (int)... | test.cpp:56:13:56:16 | (int)... |
73+
| test.cpp:59:9:59:12 | (int)... | test.cpp:56:31:56:34 | (int)... |
74+
| test.cpp:59:9:59:12 | (int)... | test.cpp:59:9:59:12 | (int)... |
75+
| test.cpp:59:9:59:12 | * ... | test.cpp:56:13:56:16 | * ... |
76+
| test.cpp:59:9:59:12 | * ... | test.cpp:56:31:56:34 | * ... |
77+
| test.cpp:59:10:59:12 | ptr | test.cpp:56:47:56:49 | ptr |
78+
| test.cpp:59:17:59:20 | (int)... | test.cpp:44:9:44:9 | 0 |
79+
| test.cpp:59:17:59:20 | (int)... | test.cpp:51:25:51:25 | 0 |
80+
| test.cpp:59:17:59:20 | (int)... | test.cpp:53:18:53:21 | (int)... |
81+
| test.cpp:59:17:59:20 | (int)... | test.cpp:56:39:56:42 | (int)... |
82+
| test.cpp:59:17:59:20 | (int)... | test.cpp:59:17:59:20 | (int)... |
83+
| test.cpp:59:17:59:20 | (int)... | test.cpp:88:12:88:12 | 0 |
84+
| test.cpp:62:5:62:10 | result | test.cpp:65:10:65:15 | result |
85+
| test.cpp:65:10:65:15 | result | test.cpp:62:5:62:10 | result |
86+
| test.cpp:77:20:77:30 | (signed short)... | test.cpp:77:20:77:30 | (signed short)... |
87+
| test.cpp:77:20:77:30 | (signed short)... | test.cpp:79:7:79:7 | v |
88+
| test.cpp:79:7:79:7 | (int)... | test.cpp:79:7:79:7 | (int)... |
89+
| test.cpp:79:7:79:7 | v | test.cpp:77:20:77:30 | (signed short)... |
90+
| test.cpp:79:11:79:20 | (int)... | test.cpp:79:11:79:20 | (int)... |
91+
| test.cpp:79:24:79:33 | (int)... | test.cpp:79:24:79:33 | (int)... |
92+
| test.cpp:80:5:80:19 | ... = ... | test.cpp:80:5:80:19 | ... = ... |
93+
| test.cpp:80:9:80:19 | (signed short)... | test.cpp:80:9:80:19 | (signed short)... |
94+
| test.cpp:88:3:88:20 | ... = ... | test.cpp:88:3:88:20 | ... = ... |
95+
| test.cpp:88:12:88:12 | 0 | test.cpp:44:9:44:9 | 0 |
96+
| test.cpp:88:12:88:12 | 0 | test.cpp:51:25:51:25 | 0 |
97+
| test.cpp:88:12:88:12 | 0 | test.cpp:53:18:53:21 | (int)... |
98+
| test.cpp:88:12:88:12 | 0 | test.cpp:56:39:56:42 | (int)... |
99+
| test.cpp:88:12:88:12 | 0 | test.cpp:59:17:59:20 | (int)... |
100+
| test.cpp:88:12:88:12 | (void *)... | test.cpp:88:12:88:12 | (void *)... |
101+
| test.cpp:105:11:105:12 | (Base *)... | test.cpp:105:11:105:12 | (Base *)... |
102+
| test.cpp:105:11:105:12 | (Base *)... | test.cpp:106:14:106:35 | static_cast<Base *>... |
103+
| test.cpp:105:11:105:12 | (Base *)... | test.cpp:107:11:107:12 | pb |
104+
| test.cpp:105:15:105:15 | b | test.cpp:107:15:107:15 | b |
105+
| test.cpp:105:15:105:15 | b | test.cpp:109:10:109:10 | y |
106+
| test.cpp:106:14:106:35 | static_cast<Base *>... | test.cpp:105:11:105:12 | (Base *)... |
107+
| test.cpp:106:14:106:35 | static_cast<Base *>... | test.cpp:106:14:106:35 | static_cast<Base *>... |
108+
| test.cpp:106:14:106:35 | static_cast<Base *>... | test.cpp:107:11:107:12 | pb |
109+
| test.cpp:107:11:107:12 | pb | test.cpp:105:11:105:12 | (Base *)... |
110+
| test.cpp:107:11:107:12 | pb | test.cpp:106:14:106:35 | static_cast<Base *>... |
111+
| test.cpp:107:15:107:15 | b | test.cpp:105:15:105:15 | b |
112+
| test.cpp:109:10:109:10 | y | test.cpp:105:15:105:15 | b |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import cpp
2+
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
3+
import semmle.code.cpp.ir.ValueNumbering
4+
import semmle.code.cpp.ir.IR
5+
6+
Expr ir(Expr e) {
7+
exists(Instruction i |
8+
e = i.getUnconvertedResultExpression() and
9+
result = valueNumber(i).getAnExpr()
10+
)
11+
}
12+
13+
Expr ast(Expr e) { result = globalValueNumber(e).getAnExpr() }
14+
15+
from Expr e, Expr evn
16+
where evn = ast(e) and not evn = ir(e)
17+
select e, evn

0 commit comments

Comments
 (0)