Skip to content

Commit 463ae4b

Browse files
committed
C++: Address review comments
1 parent d010b6e commit 463ae4b

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4147,7 +4147,7 @@ private predicate exprImmediatelyDiscarded(Expr expr) {
41474147
exists(ExprStmt s |
41484148
s = expr.getParent() and
41494149
not exists(StmtExpr se | s = se.getStmt().(BlockStmt).getLastStmt()) and
4150-
not exists(Conversion c | c = expr.getConversion*() and not isTransparentConversion(c))
4150+
not exists(expr.getConversion())
41514151
)
41524152
or
41534153
exists(CommaExpr c | c.getLeftOperand() = expr)

cpp/ql/test/library-tests/dataflow/asExpr/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void test_aggregate_literal() {
4242
void test_postfix_crement(int *p, int q) {
4343
p++; // $ asExpr="... ++" asIndirectExpr="... ++" asExpr=p asIndirectExpr=p
4444
q++; // $ asExpr="... ++" asExpr=q
45-
(p++); // $ numberOfNodes="... ++: 2" numberOfIndirectNodes="... ++: 2" asExpr="... ++" asIndirectExpr="... ++"
46-
(q++); // $ numberOfNodes="... ++: 2" asExpr="... ++"
45+
(p++); // $ asExpr="... ++" asIndirectExpr="... ++" asExpr="p(... ++)" asIndirectExpr="p(*... ++)"
46+
(q++); // $ asExpr="... ++" asExpr="q(... ++)"
4747
(void)(p++); // $ asExpr="p(... ++)" asIndirectExpr="p(*... ++)"
4848
(void)(q++); // $ asExpr="q(... ++)"
4949
(void)p++; // $ asExpr="p(... ++)" asIndirectExpr="p(*... ++)"

cpp/ql/test/library-tests/ir/ir/aliased_ir.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20184,11 +20184,13 @@ ir.cpp:
2018420184
# 2731| r2731_3(int) = Constant[1] :
2018520185
# 2731| r2731_4(int *) = PointerAdd[4] : r2731_2, r2731_3
2018620186
# 2731| m2731_5(int *) = Store[p] : &:r2731_1, r2731_4
20187+
# 2731| r2731_6(int *) = CopyValue : r2731_2
2018720188
# 2732| r2732_1(glval<int>) = VariableAddress[q] :
2018820189
# 2732| r2732_2(int) = Load[q] : &:r2732_1, m2730_5
2018920190
# 2732| r2732_3(int) = Constant[1] :
2019020191
# 2732| r2732_4(int) = Add : r2732_2, r2732_3
2019120192
# 2732| m2732_5(int) = Store[q] : &:r2732_1, r2732_4
20193+
# 2732| r2732_6(int) = CopyValue : r2732_2
2019220194
# 2733| r2733_1(glval<int *>) = VariableAddress[p] :
2019320195
# 2733| r2733_2(int *) = Load[p] : &:r2733_1, m2731_5
2019420196
# 2733| r2733_3(int) = Constant[1] :

cpp/ql/test/library-tests/ir/ir/raw_ir.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18343,11 +18343,13 @@ ir.cpp:
1834318343
# 2731| r2731_3(int) = Constant[1] :
1834418344
# 2731| r2731_4(int *) = PointerAdd[4] : r2731_2, r2731_3
1834518345
# 2731| mu2731_5(int *) = Store[p] : &:r2731_1, r2731_4
18346+
# 2731| r2731_6(int *) = CopyValue : r2731_2
1834618347
# 2732| r2732_1(glval<int>) = VariableAddress[q] :
1834718348
# 2732| r2732_2(int) = Load[q] : &:r2732_1, ~m?
1834818349
# 2732| r2732_3(int) = Constant[1] :
1834918350
# 2732| r2732_4(int) = Add : r2732_2, r2732_3
1835018351
# 2732| mu2732_5(int) = Store[q] : &:r2732_1, r2732_4
18352+
# 2732| r2732_6(int) = CopyValue : r2732_2
1835118353
# 2733| r2733_1(glval<int *>) = VariableAddress[p] :
1835218354
# 2733| r2733_2(int *) = Load[p] : &:r2733_1, ~m?
1835318355
# 2733| r2733_3(int) = Constant[1] :

0 commit comments

Comments
 (0)