mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: Address review comments
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user