Skip to content

Commit 35caede

Browse files
committed
Java: Replace SsaPhiNode with SsaPhiDefinition.
1 parent 3e43c53 commit 35caede

File tree

8 files changed

+26
-18
lines changed

8 files changed

+26
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private predicate varMaybeNull(SsaVariable v, ControlFlowNode node, string msg,
142142
msg = "as suggested by $@ null guard" and
143143
guardSuggestsVarMaybeNull(e, v) and
144144
node = v.getCfgNode() and
145-
not v instanceof SsaPhiNode and
145+
not v instanceof SsaPhiDefinition and
146146
not clearlyNotNull(v) and
147147
// Comparisons in finally blocks are excluded since missing exception edges in the CFG could otherwise yield FPs.
148148
not exists(TryStmt try | try.getFinally() = e.getEnclosingStmt().getEnclosingStmt*()) and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ module Sem implements Semantic<Location> {
248248
Expr getAUse() { result = super.getAUse() }
249249
}
250250

251-
class SsaPhiNode extends SsaVariable instanceof SSA::SsaPhiNode {
251+
class SsaPhiNode extends SsaVariable instanceof SSA::SsaPhiDefinition {
252252
predicate hasInputFromBlock(SsaVariable inp, BasicBlock bb) { super.hasInputFromBlock(inp, bb) }
253253
}
254254

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ predicate eqFlowCond = U::eqFlowCond/5;
3030
* only other input to `phi` is a `null` value.
3131
*
3232
* Note that the declared type of `phi` is `SsaVariable` instead of
33-
* `SsaPhiNode` in order for the reflexive case of `nonNullSsaFwdStep*(..)` to
34-
* have non-`SsaPhiNode` results.
33+
* `SsaPhiDefinition` in order for the reflexive case of `nonNullSsaFwdStep*(..)` to
34+
* have non-`SsaPhiDefinition` results.
3535
*/
3636
private predicate nonNullSsaFwdStep(SsaVariable v, SsaVariable phi) {
37-
exists(SsaExplicitWrite vnull, SsaPhiNode phi0 | phi0 = phi |
38-
2 = strictcount(phi0.getAPhiInput()) and
39-
vnull = phi0.getAPhiInput() and
40-
v = phi0.getAPhiInput() and
37+
exists(SsaExplicitWrite vnull, SsaPhiDefinition phi0 | phi0 = phi |
38+
2 = strictcount(phi0.getAnInput()) and
39+
vnull = phi0.getAnInput() and
40+
v = phi0.getAnInput() and
4141
not backEdge(phi0, v, _) and
4242
vnull != v and
4343
vnull.getValue() instanceof NullLiteral

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,20 @@ class SsaImplicitInit extends SsaVariable instanceof WriteDefinition {
381381
}
382382
}
383383

384-
/** An SSA phi node. */
385-
class SsaPhiNode extends SsaVariable instanceof PhiNode {
384+
/**
385+
* DEPRECATED: Use `SsaPhiDefinition` instead.
386+
*
387+
* An SSA phi node.
388+
*/
389+
deprecated class SsaPhiNode extends SsaVariable instanceof PhiNode {
386390
override string toString() { result = "SSA phi(" + this.getSourceVariable() + ")" }
387391

388-
/** Gets an input to the phi node defining the SSA variable. */
389-
SsaVariable getAPhiInput() { this.hasInputFromBlock(result, _) }
392+
/**
393+
* DEPRECATED: Use `getAnInput()` instead.
394+
*
395+
* Gets an input to the phi node defining the SSA variable.
396+
*/
397+
deprecated SsaVariable getAPhiInput() { this.hasInputFromBlock(result, _) }
390398

391399
/** Gets an input to the phi node defining the SSA variable. */
392400
SsaVariable getAnInput() { this.hasInputFromBlock(result, _) }

java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/ModulusAnalysisSpecific.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Private {
1313

1414
class SsaVariable = Ssa::SsaVariable;
1515

16-
class SsaPhiNode = Ssa::SsaPhiNode;
16+
class SsaPhiNode = Ssa::SsaPhiDefinition;
1717

1818
class Expr = J::Expr;
1919

java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module Private {
1919

2020
class SsaVariable = Ssa::SsaVariable;
2121

22-
class SsaPhiNode = Ssa::SsaPhiNode;
22+
class SsaPhiNode = Ssa::SsaPhiDefinition;
2323

2424
class VarAccess = J::VarAccess;
2525

java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SsaReadPositionSpecific.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private import SsaReadPositionCommon
1010

1111
class SsaVariable = Ssa::SsaVariable;
1212

13-
class SsaPhiNode = Ssa::SsaPhiNode;
13+
class SsaPhiNode = Ssa::SsaPhiDefinition;
1414

1515
class BasicBlock = BB::BasicBlock;
1616

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import java
22
import semmle.code.java.dataflow.SSA
33

4-
from SsaPhiNode ssa, SsaSourceVariable v, SsaVariable phiInput
5-
where ssa.getAPhiInput() = phiInput and ssa.getSourceVariable() = v
6-
select v, ssa.getCfgNode(), phiInput.getCfgNode()
4+
from SsaPhiDefinition ssa, SsaSourceVariable v, SsaDefinition phiInput
5+
where ssa.getAnInput() = phiInput and ssa.getSourceVariable() = v
6+
select v, ssa.getControlFlowNode(), phiInput.getControlFlowNode()

0 commit comments

Comments
 (0)