mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
CPP: Simplify out some old optimizations (that make little difference now).
This commit is contained in:
@@ -51,23 +51,14 @@ predicate allocExprOrIndirect(Expr alloc, string kind) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `v` is a global variable assigned value `e`, and `e` is not known
|
||||
* to be `0`.
|
||||
*/
|
||||
private predicate nonNullGlobalAssignment(Variable v, Expr e) {
|
||||
not v instanceof LocalScopeVariable and
|
||||
v.getAnAssignedValue() = e and
|
||||
not e.getValue().toInt() = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `v` is a non-local variable which is assigned with allocations of
|
||||
* type `kind`.
|
||||
*/
|
||||
private cached predicate allocReachesVariable(Variable v, Expr alloc, string kind) {
|
||||
exists(Expr mid |
|
||||
nonNullGlobalAssignment(v, mid) and
|
||||
not v instanceof LocalScopeVariable and
|
||||
v.getAnAssignedValue() = mid and
|
||||
allocReaches0(mid, alloc, kind)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user