Skip to content

Commit c10e00d

Browse files
committed
C++: Add a subclass for constant instructions with pointer type.
1 parent bf61114 commit c10e00d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,8 @@ class ConstantInstruction extends ConstantValueInstruction {
995995
*/
996996
class IntegerConstantInstruction extends ConstantInstruction {
997997
IntegerConstantInstruction() {
998-
exists(IRType resultType |
999-
resultType = this.getResultIRType() and
1000-
(resultType instanceof IRIntegerType or resultType instanceof IRBooleanType)
998+
exists(IRType resultType | resultType = this.getResultIRType() |
999+
resultType instanceof IRIntegerType or resultType instanceof IRBooleanType
10011000
)
10021001
}
10031002
}
@@ -1009,6 +1008,17 @@ class FloatConstantInstruction extends ConstantInstruction {
10091008
FloatConstantInstruction() { this.getResultIRType() instanceof IRFloatingPointType }
10101009
}
10111010

1011+
/**
1012+
* An instruction whose result is a constant value of a pointer type.
1013+
*/
1014+
class PointerConstantInstruction extends ConstantInstruction {
1015+
PointerConstantInstruction() {
1016+
exists(IRType resultType | resultType = this.getResultIRType() |
1017+
resultType instanceof IRAddressType or resultType instanceof IRFunctionAddressType
1018+
)
1019+
}
1020+
}
1021+
10121022
/**
10131023
* An instruction whose result is the address of a string literal.
10141024
*/

0 commit comments

Comments
 (0)