Skip to content

Commit e75ed5a

Browse files
committed
Java: Merge BaseSSA cached stages.
1 parent 3313533 commit e75ed5a

File tree

1 file changed

+20
-1
lines changed
  • java/ql/lib/semmle/code/java/dataflow/internal

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,26 @@
1414
import java
1515
private import codeql.ssa.Ssa as SsaImplCommon
1616

17+
cached
18+
private module BaseSsaStage {
19+
cached
20+
predicate ref() { any() }
21+
22+
cached
23+
predicate backref() {
24+
(exists(TLocalVar(_, _)) implies any()) and
25+
(exists(any(BaseSsaSourceVariable v).getAnAccess()) implies any()) and
26+
(exists(getAUse(_)) implies any())
27+
}
28+
}
29+
30+
cached
1731
private newtype TBaseSsaSourceVariable =
1832
TLocalVar(Callable c, LocalScopeVariable v) {
19-
c = v.getCallable() or c = v.getAnAccess().getEnclosingCallable()
33+
BaseSsaStage::ref() and
34+
c = v.getCallable()
35+
or
36+
c = v.getAnAccess().getEnclosingCallable()
2037
}
2138

2239
/**
@@ -31,6 +48,7 @@ class BaseSsaSourceVariable extends TBaseSsaSourceVariable {
3148
*/
3249
cached
3350
VarAccess getAnAccess() {
51+
BaseSsaStage::ref() and
3452
exists(LocalScopeVariable v, Callable c |
3553
this = TLocalVar(c, v) and result = v.getAnAccess() and result.getEnclosingCallable() = c
3654
)
@@ -188,6 +206,7 @@ cached
188206
private module Cached {
189207
cached
190208
VarRead getAUse(Impl::Definition def) {
209+
BaseSsaStage::ref() and
191210
exists(BaseSsaSourceVariable v, BasicBlock bb, int i |
192211
Impl::ssaDefReachesRead(v, def, bb, i) and
193212
result.getControlFlowNode() = bb.getNode(i) and

0 commit comments

Comments
 (0)