Skip to content

Commit 5acd2bb

Browse files
committed
C++: Adjust the result type at 'NotExpr' and at comparisons.
1 parent 9429b03 commit 5acd2bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,8 @@ class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
13231323
class TranslatedNotExpr extends TranslatedNonConstantExpr {
13241324
override NotExpr expr;
13251325

1326+
override Type getExprType() { result instanceof BoolType }
1327+
13261328
final override Instruction getFirstInstruction(EdgeKind kind) {
13271329
result = this.getOperand().getFirstInstruction(kind)
13281330
}
@@ -1807,6 +1809,12 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
18071809
result = comparisonOpcode(expr)
18081810
}
18091811

1812+
override Type getExprType() {
1813+
if exists(comparisonOpcode(expr))
1814+
then result instanceof BoolType
1815+
else result = super.getExprType()
1816+
}
1817+
18101818
override int getInstructionElementSize(InstructionTag tag) {
18111819
tag = OnlyInstructionTag() and
18121820
exists(Opcode opcode |

0 commit comments

Comments
 (0)