Skip to content

Commit 8de1ed0

Browse files
committed
C++: Address review comments
1 parent 9431b0c commit 8de1ed0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,16 +4144,15 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
41444144
exists(int n, Type dimType |
41454145
pointerDerefCount <= n and
41464146
n < vlaDimensions and
4147-
dimType = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getUnderlyingType()
4147+
dimType = this.getDimensionExpr(n).getUnderlyingType() and
4148+
tag = SizeofVlaConversionTag(n)
41484149
|
41494150
(
41504151
expr.getUnderlyingType() = dimType and
4151-
opcode instanceof Opcode::CopyValue and
4152-
tag = SizeofVlaConversionTag(n)
4152+
opcode instanceof Opcode::CopyValue
41534153
or
41544154
not expr.getUnderlyingType() = dimType and
4155-
opcode instanceof Opcode::Convert and
4156-
tag = SizeofVlaConversionTag(n)
4155+
opcode instanceof Opcode::Convert
41574156
)
41584157
) and
41594158
resultType = this.getResultType()
@@ -4213,9 +4212,7 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
42134212
tag = SizeofVlaConversionTag(n) and
42144213
(
42154214
operandTag instanceof UnaryOperandTag and
4216-
result =
4217-
getTranslatedExpr(vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr())
4218-
.getResult()
4215+
result = getTranslatedExpr(this.getDimensionExpr(n)).getResult()
42194216
)
42204217
)
42214218
or
@@ -4237,6 +4234,10 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
42374234
)
42384235
}
42394236

4237+
private Expr getDimensionExpr(int n) {
4238+
result = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getFullyConverted()
4239+
}
4240+
42404241
final override Instruction getResult() {
42414242
result = this.getInstruction(SizeofVlaDimensionTag(vlaDimensions - 1))
42424243
}

0 commit comments

Comments
 (0)