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