C++: Adjust the result type at 'NotExpr' and at comparisons.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-11-19 11:00:43 +00:00
parent 9429b03896
commit 5acd2bb2fb

View File

@@ -1323,6 +1323,8 @@ class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
class TranslatedNotExpr extends TranslatedNonConstantExpr {
override NotExpr expr;
override Type getExprType() { result instanceof BoolType }
final override Instruction getFirstInstruction(EdgeKind kind) {
result = this.getOperand().getFirstInstruction(kind)
}
@@ -1807,6 +1809,12 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
result = comparisonOpcode(expr)
}
override Type getExprType() {
if exists(comparisonOpcode(expr))
then result instanceof BoolType
else result = super.getExprType()
}
override int getInstructionElementSize(InstructionTag tag) {
tag = OnlyInstructionTag() and
exists(Opcode opcode |