C++: respond to PR comments

This commit is contained in:
Robert Marsh
2018-08-27 13:44:27 -07:00
parent e6314c5f35
commit fede8d63d4
5 changed files with 74 additions and 66 deletions

View File

@@ -38,7 +38,7 @@
| test.cpp:92:11:92:11 | x | 92:c11-c11 93:c10-c10 |
| test.cpp:97:3:97:3 | x | 97:c3-c3 98:c3-c3 |
| test.cpp:97:3:97:5 | ... ++ | 97:c3-c5 98:c3-c5 |
| test.cpp:103:10:103:11 | 1 | 103:c10-c11 104:c7-c7 107:c7-c7 108:c7-c7 10:c16-c16 |
| test.cpp:103:10:103:11 | 1 | 103:c10-c11 104:c7-c7 107:c7-c7 108:c7-c7 10:c16-c16 179:c21-c21 |
| test.cpp:104:3:104:3 | x | 104:c3-c3 105:c3-c3 106:c3-c3 107:c3-c3 108:c3-c3 |
| test.cpp:105:7:105:7 | 2 | 105:c7-c7 106:c7-c7 107:c11-c11 108:c11-c11 21:c16-c16 |
| test.cpp:107:7:107:11 | ... + ... | 107:c7-c11 108:c7-c11 |
@@ -69,3 +69,7 @@
| test.cpp:156:14:156:20 | 0 | 156:c14-c20 156:c3-c9 157:c10-c16 |
| test.cpp:171:3:171:6 | (int)... | 171:c3-c6 172:c3-c6 |
| test.cpp:171:3:171:6 | e1x1 | 171:c3-c6 172:c3-c6 |
| test.cpp:179:10:179:22 | (...) | 179:c10-c22 179:c10-c22 |
| test.cpp:179:17:179:17 | y | 179:c17-c17 179:c17-c17 |
| test.cpp:179:17:179:21 | ... + ... | 179:c17-c21 179:c17-c21 |
| test.cpp:185:17:185:17 | y | 185:c17-c17 185:c17-c17 |

View File

@@ -1,7 +1,7 @@
import cpp
import semmle.code.cpp.valuenumbering.HashCons
from HC h
from HashCons h
where strictcount(h.getAnExpr()) > 1
select
h,

View File

@@ -5,4 +5,4 @@ import semmle.code.cpp.valuenumbering.HashCons
// So this query should have zero results.
from Expr e
where count(hashCons(e)) != 1
select e, concat(HC h | h = hashCons(e) | h.getKind(), ", ")
select e, concat(HashCons h | h = hashCons(e) | h.getKind(), ", ")

View File

@@ -172,3 +172,15 @@ int test12() {
e1x1 == e2x2;
return e1x2;
}
#define SQUARE(x) ((x) * (x))
int test13(int y) {
return SQUARE(y + 1);
}
#define SQUARE(x) x * x
int test14(int y) {
return SQUARE(y);
}