Skip to content

Commit ae7904f

Browse files
committed
C#: Fix BaseSSA caching.
1 parent bbd6003 commit ae7904f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • csharp/ql/lib/semmle/code/csharp/dataflow/internal

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ module BaseSsa {
77
private import AssignableDefinitions
88
private import codeql.ssa.Ssa as SsaImplCommon
99

10+
cached
11+
private module BaseSsaStage {
12+
cached
13+
predicate ref() { any() }
14+
15+
cached
16+
predicate backref() { (exists(any(SsaDefinition def).getARead()) implies any()) }
17+
}
18+
1019
/**
1120
* Holds if the `i`th node of basic block `bb` is assignable definition `def`,
1221
* targeting local scope variable `v`.
@@ -83,6 +92,7 @@ module BaseSsa {
8392
class SourceVariable = SimpleLocalScopeVariable;
8493

8594
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) {
95+
BaseSsaStage::ref() and
8696
exists(AssignableDefinition def |
8797
definitionAt(def, bb, i, v) and
8898
if def.isCertain() then certain = true else certain = false

0 commit comments

Comments
 (0)