Skip to content

Commit 958602e

Browse files
committed
JS: Cache getARead (as per instructions in the SSA library)
1 parent e784813 commit 958602e

File tree

1 file changed

+10
-0
lines changed
  • javascript/ql/lib/semmle/javascript/dataflow/internal/sharedlib

1 file changed

+10
-0
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/sharedlib/Ssa.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ module SsaDataflowInput implements DataFlowIntegrationInputSig {
6666

6767
predicate ssaDefInitializesParam(WriteDefinition def, Parameter p) { none() } // Not handled here
6868

69+
cached
70+
Expr getARead(Definition def) {
71+
// Copied from implementation so we can cache it here
72+
exists(SsaConfig::SourceVariable v, js::BasicBlock bb, int i |
73+
ssaDefReachesRead(v, def, bb, i) and
74+
SsaConfig::variableRead(bb, i, v, true) and
75+
result.hasCfgNode(bb, i)
76+
)
77+
}
78+
6979
class Guard extends js::ControlFlowNode {
7080
Guard() { this = any(js::ConditionGuardNode g).getTest() }
7181

0 commit comments

Comments
 (0)