Skip to content

Commit b093ae9

Browse files
hvitvedaschackmull
andauthored
Apply suggestions from code review
Co-authored-by: Anders Schack-Mulligen <[email protected]>
1 parent f8c0c6f commit b093ae9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

java/ql/lib/semmle/code/java/dataflow/SSA.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@ class SsaVariable extends Definition {
144144
SsaSourceVariable getSourceVariable() { result = super.getSourceVariable() }
145145

146146
/** Gets the `ControlFlowNode` at which this SSA variable is defined. */
147+
pragma[nomagic]
147148
ControlFlowNode getCfgNode() {
148149
exists(BasicBlock bb, int i, int j |
149150
this.definesAt(_, bb, i) and
150151
// untracked definitions are inserted just before reads
151152
(if this instanceof UntrackedDef then j = i + 1 else j = i) and
152153
// phi nodes are inserted at position `-1`
153-
result = bb.getNode(max([j, 0]))
154+
result = bb.getNode(0.maximum(j))
154155
)
155156
}
156157

java/ql/lib/semmle/code/java/dataflow/internal/SsaImpl.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,16 @@ private module Cached {
465465
)
466466
}
467467

468+
bindingset[call, f]
469+
pragma[inline_late]
470+
private predicate updatesNamedField0(Call call, TrackedField f, Callable setter) {
471+
updatesNamedField(call, f, setter)
472+
}
473+
468474
cached
469475
predicate defUpdatesNamedField(SsaImplicitUpdate def, TrackedField f, Callable setter) {
470476
f = def.getSourceVariable() and
471-
updatesNamedField(def.getCfgNode().asCall(), f, setter)
477+
updatesNamedField0(def.getCfgNode().asCall(), f, setter)
472478
}
473479

474480
cached

0 commit comments

Comments
 (0)