Skip to content

Commit 72d83cc

Browse files
committed
ControlFlowReachability: Align the SSA signature with the one from shared SSA.
1 parent f257c7a commit 72d83cc

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowReachability.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ private module ControlFlowInput implements
3333

3434
class SsaDefinition = Ssa::Definition;
3535

36-
class SsaWriteDefinition extends SsaDefinition instanceof Ssa::ExplicitDefinition {
37-
Expr getDefinition() { result = super.getADefinition().getSource() }
36+
class SsaExplicitWrite extends SsaDefinition instanceof Ssa::ExplicitDefinition {
37+
Expr getValue() { result = super.getADefinition().getSource() }
3838
}
3939

40-
class SsaPhiNode = Ssa::PhiNode;
40+
class SsaPhiDefinition = Ssa::PhiNode;
4141

42-
class SsaUncertainDefinition = Ssa::UncertainDefinition;
42+
class SsaUncertainWrite = Ssa::UncertainDefinition;
4343

4444
class GuardValue = Guards::GuardValue;
4545

java/ql/lib/semmle/code/java/controlflow/ControlFlowReachability.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ private module ControlFlowInput implements InputSig<Location, ControlFlowNode, B
3131

3232
class SsaDefinition = SSA::SsaVariable;
3333

34-
class SsaWriteDefinition extends SsaDefinition instanceof SSA::SsaExplicitUpdate {
35-
Expr getDefinition() {
34+
class SsaExplicitWrite extends SsaDefinition instanceof SSA::SsaExplicitUpdate {
35+
Expr getValue() {
3636
super.getDefiningExpr().(VariableAssign).getSource() = result or
3737
super.getDefiningExpr().(AssignOp) = result
3838
}
3939
}
4040

41-
class SsaPhiNode = SSA::SsaPhiNode;
41+
class SsaPhiDefinition = SSA::SsaPhiNode;
4242

43-
class SsaUncertainDefinition extends SsaDefinition instanceof SSA::SsaUncertainImplicitUpdate {
43+
class SsaUncertainWrite extends SsaDefinition instanceof SSA::SsaUncertainImplicitUpdate {
4444
SsaDefinition getPriorDefinition() { result = super.getPriorDef() }
4545
}
4646

shared/controlflow/codeql/controlflow/ControlFlowReachability.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ signature module InputSig<LocationSig Location, TypSig ControlFlowNode, TypSig B
5656
predicate isLiveAtEndOfBlock(BasicBlock b);
5757
}
5858

59-
class SsaWriteDefinition extends SsaDefinition {
60-
Expr getDefinition();
59+
class SsaExplicitWrite extends SsaDefinition {
60+
Expr getValue();
6161
}
6262

63-
class SsaPhiNode extends SsaDefinition {
63+
class SsaPhiDefinition extends SsaDefinition {
6464
/** Holds if `inp` is an input to the phi node along the edge originating in `bb`. */
6565
predicate hasInputFromBlock(SsaDefinition inp, BasicBlock bb);
6666

6767
SsaDefinition getAnInput();
6868
}
6969

70-
class SsaUncertainDefinition extends SsaDefinition {
70+
class SsaUncertainWrite extends SsaDefinition {
7171
/**
7272
* Gets the immediately preceding definition. Since this update is uncertain,
7373
* the value from the preceding definition might still be valid.
@@ -274,9 +274,9 @@ module Make<
274274
* If multiple values apply, including a singleton, then we only include the
275275
* singleton.
276276
*/
277-
private predicate ssaHasValue(SsaWriteDefinition def, GuardValue gv) {
277+
private predicate ssaHasValue(SsaExplicitWrite def, GuardValue gv) {
278278
exists(Expr e |
279-
def.getDefinition() = e and
279+
def.getValue() = e and
280280
exprHasValue(e, gv) and
281281
(any(GuardValue gv0 | exprHasValue(e, gv0)).isSingleton() implies gv.isSingleton())
282282
)
@@ -398,7 +398,7 @@ module Make<
398398
}
399399

400400
private predicate uncertainStep(SsaDefinition def1, SsaDefinition def2) {
401-
def2.(SsaUncertainDefinition).getPriorDefinition() = def1 and
401+
def2.(SsaUncertainWrite).getPriorDefinition() = def1 and
402402
Config::uncertainFlow()
403403
}
404404

@@ -459,7 +459,7 @@ module Make<
459459

460460
pragma[nomagic]
461461
private predicate phiBlock(BasicBlock bb, SourceVariable v) {
462-
exists(SsaPhiNode phi | phi.getBasicBlock() = bb and phi.getSourceVariable() = v)
462+
exists(SsaPhiDefinition phi | phi.getBasicBlock() = bb and phi.getSourceVariable() = v)
463463
}
464464

465465
/** Holds if `def1` in `bb1` may step to `def2` in `bb2`. */
@@ -468,7 +468,7 @@ module Make<
468468
not Config::barrierEdge(bb1, bb2) and
469469
not ssaValueBarrierEdge(def1, bb1, bb2) and
470470
(
471-
def2.(SsaPhiNode).hasInputFromBlock(def1, bb1) and bb2 = def2.getBasicBlock()
471+
def2.(SsaPhiDefinition).hasInputFromBlock(def1, bb1) and bb2 = def2.getBasicBlock()
472472
or
473473
exists(SourceVariable v |
474474
ssaRelevantAtEndOfBlock(def1, bb1) and
@@ -661,10 +661,10 @@ module Make<
661661
|
662662
def.getBasicBlock().dominates(loopEntry)
663663
or
664-
exists(SsaPhiNode phi |
664+
exists(SsaPhiDefinition phi |
665665
phi.definesAt(var, loopEntry, _) and
666666
phi.getAnInput+() = def and
667-
def.(SsaPhiNode).getAnInput*() = phi
667+
def.(SsaPhiDefinition).getAnInput*() = phi
668668
)
669669
)
670670
}
@@ -703,7 +703,7 @@ module Make<
703703
pathEdge(src, bb1, bb2) and
704704
relevantSplit(src, var, condgv) and
705705
lastDefInBlock(var, t, bb2) and
706-
not t instanceof SsaPhiNode and
706+
not t instanceof SsaPhiDefinition and
707707
(
708708
exists(GuardValue gv |
709709
ssaHasValue(t, gv) and
@@ -730,7 +730,7 @@ module Make<
730730
pathEdge(src, bb1, bb2) and
731731
relevantSplit(src, var, condgv) and
732732
lastDefInBlock(var, t2, bb2) and
733-
t2.(SsaPhiNode).hasInputFromBlock(t1, bb1) and
733+
t2.(SsaPhiDefinition).hasInputFromBlock(t1, bb1) and
734734
(
735735
exists(GuardValue gv |
736736
ssaControlsPathEdge(src, t1, _, gv, bb1, bb2) and

0 commit comments

Comments
 (0)