mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
This commit is contained in:
@@ -144,13 +144,14 @@ class SsaVariable extends Definition {
|
||||
SsaSourceVariable getSourceVariable() { result = super.getSourceVariable() }
|
||||
|
||||
/** Gets the `ControlFlowNode` at which this SSA variable is defined. */
|
||||
pragma[nomagic]
|
||||
ControlFlowNode getCfgNode() {
|
||||
exists(BasicBlock bb, int i, int j |
|
||||
this.definesAt(_, bb, i) and
|
||||
// untracked definitions are inserted just before reads
|
||||
(if this instanceof UntrackedDef then j = i + 1 else j = i) and
|
||||
// phi nodes are inserted at position `-1`
|
||||
result = bb.getNode(max([j, 0]))
|
||||
result = bb.getNode(0.maximum(j))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -465,10 +465,16 @@ private module Cached {
|
||||
)
|
||||
}
|
||||
|
||||
bindingset[call, f]
|
||||
pragma[inline_late]
|
||||
private predicate updatesNamedField0(Call call, TrackedField f, Callable setter) {
|
||||
updatesNamedField(call, f, setter)
|
||||
}
|
||||
|
||||
cached
|
||||
predicate defUpdatesNamedField(SsaImplicitUpdate def, TrackedField f, Callable setter) {
|
||||
f = def.getSourceVariable() and
|
||||
updatesNamedField(def.getCfgNode().asCall(), f, setter)
|
||||
updatesNamedField0(def.getCfgNode().asCall(), f, setter)
|
||||
}
|
||||
|
||||
cached
|
||||
|
||||
Reference in New Issue
Block a user