Skip to content

Commit 3f7735f

Browse files
committed
unified: Use hasControlFlowPosition in CaptureSsa
1 parent a808fde commit 3f7735f

1 file changed

Lines changed: 2 additions & 23 deletions

File tree

‎unified/ql/lib/codeql/unified/internal/dataflow/CaptureSsa.qll‎

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,14 @@ module CaptureSsaInput implements InputSig<Location, BasicBlock> {
3535
CapturedParameter() { none() }
3636
}
3737

38-
private class TExpr = TCallableNode or TLocalVariableRefNode or TImplicitArgumentNode;
39-
4038
private predicate isTopLevelCallable(BuilderNode callable) {
4139
callable.isCallable(any(TopLevel t))
4240
}
4341

44-
class Expr extends TExpr {
42+
class Expr extends Stage2Node {
4543
Expr() { not isTopLevelCallable(this) }
4644

47-
string toString() { result = this.(BuilderNode).toString() }
48-
49-
Location getLocation() { result = this.(BuilderNode).getLocation() }
50-
51-
predicate hasCfgNode(BasicBlock bb, int i) {
52-
this.(LocalVariableRefNode).hasCfgNode(bb, i)
53-
or
54-
exists(DataFlowCallable callable |
55-
this = TCallableNode(callable) and
56-
bb.getNode(i).injects(callable.asSourceCallable())
57-
)
58-
or
59-
// We need to associate a CFG node with the callee argument passed to a capturing getter/setter,
60-
// so it can carry captured data in and out the getter/setter.
61-
exists(DataFlowCall call | this = TImplicitArgumentNode(call, _, false) |
62-
performsVariableAccess(call.asGetterCall(), _, TRead(), bb.getNode(i))
63-
or
64-
performsVariableAccess(call.asSetterCall(), _, TWrite(), bb.getNode(i))
65-
)
66-
}
45+
predicate hasCfgNode(BasicBlock bb, int i) { this.hasControlFlowPosition(bb, i) }
6746
}
6847

6948
final private class FinalLocalVariableRefNode = LocalVariableRefNode;

0 commit comments

Comments
 (0)