C++: Address review comments

This commit is contained in:
Jeroen Ketema
2025-09-02 17:03:48 +02:00
parent 9431b0c754
commit 8de1ed0d85

View File

@@ -4144,16 +4144,15 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
exists(int n, Type dimType |
pointerDerefCount <= n and
n < vlaDimensions and
dimType = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getUnderlyingType()
dimType = this.getDimensionExpr(n).getUnderlyingType() and
tag = SizeofVlaConversionTag(n)
|
(
expr.getUnderlyingType() = dimType and
opcode instanceof Opcode::CopyValue and
tag = SizeofVlaConversionTag(n)
opcode instanceof Opcode::CopyValue
or
not expr.getUnderlyingType() = dimType and
opcode instanceof Opcode::Convert and
tag = SizeofVlaConversionTag(n)
opcode instanceof Opcode::Convert
)
) and
resultType = this.getResultType()
@@ -4213,9 +4212,7 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
tag = SizeofVlaConversionTag(n) and
(
operandTag instanceof UnaryOperandTag and
result =
getTranslatedExpr(vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr())
.getResult()
result = getTranslatedExpr(this.getDimensionExpr(n)).getResult()
)
)
or
@@ -4237,6 +4234,10 @@ class TranslatedSizeofExpr extends TranslatedNonConstantExpr {
)
}
private Expr getDimensionExpr(int n) {
result = vlaDeclStmt.getTransitiveVlaDimensionStmt(n).getDimensionExpr().getFullyConverted()
}
final override Instruction getResult() {
result = this.getInstruction(SizeofVlaDimensionTag(vlaDimensions - 1))
}