mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Don't omit self from uninitialized writes
We can safely create uninitialized writes for `self` variables, because they appear at index -1 in the entry block of a method, and are immediately overwritten by a write to `self` at index 0. As a result, they are not live and will be pruned from the CFG.
This commit is contained in:
@@ -7,8 +7,7 @@ private import CfgNodes::ExprNodes
|
||||
/** Holds if `v` is uninitialized at index `i` in entry block `bb`. */
|
||||
predicate uninitializedWrite(EntryBasicBlock bb, int i, LocalVariable v) {
|
||||
v.getDeclaringScope() = bb.getScope() and
|
||||
i = -1 and
|
||||
not v instanceof SelfVariable
|
||||
i = -1
|
||||
}
|
||||
|
||||
/** Holds if `bb` contains a caputured read of variable `v`. */
|
||||
|
||||
Reference in New Issue
Block a user