1414import java
1515private 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
1731private 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
188206private 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