Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c94144

Browse files
author
Robert Marsh
committed
C++: remove abstract classes in IR
1 parent 755e21d commit 4c94144

4 files changed

Lines changed: 42 additions & 14 deletions

File tree

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,31 @@ class GuardCondition extends Expr {
4646
* being short-circuited) then it will only control blocks dominated by the
4747
* true (for `&&`) or false (for `||`) branch.
4848
*/
49-
abstract cached predicate controls(BasicBlock controlled, boolean testIsTrue);
49+
cached predicate controls(BasicBlock controlled, boolean testIsTrue) {
50+
none()
51+
}
5052

5153
/** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */
52-
abstract cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue);
54+
cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) {
55+
none()
56+
}
5357

5458
/** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`.
5559
If `isLessThan = false` then this implies `left >= right + k`. */
56-
abstract cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan);
60+
cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) {
61+
none()
62+
}
5763

5864
/** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */
59-
abstract cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue);
65+
cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) {
66+
none()
67+
}
6068

6169
/** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`.
6270
If `areEqual = false` then this implies `left != right + k`. */
63-
abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual);
71+
cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) {
72+
none()
73+
}
6474
}
6575

6676
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,19 +980,25 @@ class RelationalInstruction extends CompareInstruction {
980980
* if the overall instruction evaluates to `true`; for example on
981981
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
982982
*/
983-
abstract Instruction getGreaterOperand();
983+
Instruction getGreaterOperand() {
984+
none()
985+
}
984986

985987
/**
986988
* Gets the operand on the "lesser" (or "lesser-or-equal") side
987989
* of this relational instruction, that is, the side that is smaller
988990
* if the overall instruction evaluates to `true`; for example on
989991
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
990992
*/
991-
abstract Instruction getLesserOperand();
993+
Instruction getLesserOperand() {
994+
none()
995+
}
992996
/**
993997
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
994998
*/
995-
abstract predicate isStrict();
999+
predicate isStrict() {
1000+
none()
1001+
}
9961002
}
9971003

9981004
class CompareLTInstruction extends RelationalInstruction {

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,19 +980,25 @@ class RelationalInstruction extends CompareInstruction {
980980
* if the overall instruction evaluates to `true`; for example on
981981
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
982982
*/
983-
abstract Instruction getGreaterOperand();
983+
Instruction getGreaterOperand() {
984+
none()
985+
}
984986

985987
/**
986988
* Gets the operand on the "lesser" (or "lesser-or-equal") side
987989
* of this relational instruction, that is, the side that is smaller
988990
* if the overall instruction evaluates to `true`; for example on
989991
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
990992
*/
991-
abstract Instruction getLesserOperand();
993+
Instruction getLesserOperand() {
994+
none()
995+
}
992996
/**
993997
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
994998
*/
995-
abstract predicate isStrict();
999+
predicate isStrict() {
1000+
none()
1001+
}
9961002
}
9971003

9981004
class CompareLTInstruction extends RelationalInstruction {

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,19 +980,25 @@ class RelationalInstruction extends CompareInstruction {
980980
* if the overall instruction evaluates to `true`; for example on
981981
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
982982
*/
983-
abstract Instruction getGreaterOperand();
983+
Instruction getGreaterOperand() {
984+
none()
985+
}
984986

985987
/**
986988
* Gets the operand on the "lesser" (or "lesser-or-equal") side
987989
* of this relational instruction, that is, the side that is smaller
988990
* if the overall instruction evaluates to `true`; for example on
989991
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
990992
*/
991-
abstract Instruction getLesserOperand();
993+
Instruction getLesserOperand() {
994+
none()
995+
}
992996
/**
993997
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
994998
*/
995-
abstract predicate isStrict();
999+
predicate isStrict() {
1000+
none()
1001+
}
9961002
}
9971003

9981004
class CompareLTInstruction extends RelationalInstruction {

0 commit comments

Comments
 (0)