Skip to content

Commit a9ce2f7

Browse files
committed
CPP: Simplify out some old optimizations (that make little difference now).
1 parent df73bb3 commit a9ce2f7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

cpp/ql/src/Critical/NewDelete.qll

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,14 @@ predicate allocExprOrIndirect(Expr alloc, string kind) {
5151
)
5252
}
5353

54-
/**
55-
* Holds if `v` is a global variable assigned value `e`, and `e` is not known
56-
* to be `0`.
57-
*/
58-
private predicate nonNullGlobalAssignment(Variable v, Expr e) {
59-
not v instanceof LocalScopeVariable and
60-
v.getAnAssignedValue() = e and
61-
not e.getValue().toInt() = 0
62-
}
63-
6454
/**
6555
* Holds if `v` is a non-local variable which is assigned with allocations of
6656
* type `kind`.
6757
*/
6858
private cached predicate allocReachesVariable(Variable v, Expr alloc, string kind) {
6959
exists(Expr mid |
70-
nonNullGlobalAssignment(v, mid) and
60+
not v instanceof LocalScopeVariable and
61+
v.getAnAssignedValue() = mid and
7162
allocReaches0(mid, alloc, kind)
7263
)
7364
}

0 commit comments

Comments
 (0)