14
14
import java
15
15
private import codeql.ssa.Ssa as SsaImplCommon
16
16
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
17
31
private newtype TBaseSsaSourceVariable =
18
32
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 ( )
20
37
}
21
38
22
39
/**
@@ -31,6 +48,7 @@ class BaseSsaSourceVariable extends TBaseSsaSourceVariable {
31
48
*/
32
49
cached
33
50
VarAccess getAnAccess ( ) {
51
+ BaseSsaStage:: ref ( ) and
34
52
exists ( LocalScopeVariable v , Callable c |
35
53
this = TLocalVar ( c , v ) and result = v .getAnAccess ( ) and result .getEnclosingCallable ( ) = c
36
54
)
@@ -188,6 +206,7 @@ cached
188
206
private module Cached {
189
207
cached
190
208
VarRead getAUse ( Impl:: Definition def ) {
209
+ BaseSsaStage:: ref ( ) and
191
210
exists ( BaseSsaSourceVariable v , BasicBlock bb , int i |
192
211
Impl:: ssaDefReachesRead ( v , def , bb , i ) and
193
212
result .getControlFlowNode ( ) = bb .getNode ( i ) and
0 commit comments