Skip to content

Commit b78537d

Browse files
committed
C++: Allow comparisons with pointer types in IRGuards.
1 parent e78091e commit b78537d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,5 +1156,14 @@ private predicate add_eq(
11561156
)
11571157
}
11581158

1159+
private class IntegerOrPointerConstantInstruction extends ConstantInstruction {
1160+
IntegerOrPointerConstantInstruction() {
1161+
this instanceof IntegerConstantInstruction or
1162+
this instanceof PointerConstantInstruction
1163+
}
1164+
}
1165+
11591166
/** The int value of integer constant expression. */
1160-
private int int_value(Instruction i) { result = i.(IntegerConstantInstruction).getValue().toInt() }
1167+
private int int_value(Instruction i) {
1168+
result = i.(IntegerOrPointerConstantInstruction).getValue().toInt()
1169+
}

0 commit comments

Comments
 (0)