@@ -37,6 +37,7 @@ module Stages {
3737 */
3838 cached
3939 module SSA {
40+ // TODO: This is more a "basic AST", not a "SSA" stage.
4041 /**
4142 * Always holds.
4243 * Ensures that a predicate is evaluated as part of the Ast stage.
@@ -47,6 +48,10 @@ module Stages {
4748 private import semmle.python.essa.SsaDefinitions as SsaDefinitions
4849 private import semmle.python.essa.SsaCompute as SsaCompute
4950 private import semmle.python.essa.Essa as Essa
51+ private import semmle.python.Module as PyModule
52+ private import semmle.python.Exprs as Exprs
53+ private import semmle.python.AstExtended as AstExtended
54+ private import semmle.python.Flow as PyFlow
5055
5156 /**
5257 * DONT USE!
@@ -61,6 +66,47 @@ module Stages {
6166 SsaCompute:: SsaDefinitions:: reachesEndOfBlock ( _, _, _, _)
6267 or
6368 exists ( any ( Essa:: PhiFunction p ) .getInput ( _) )
69+ or
70+ exists ( PyModule:: moduleNameFromFile ( _) )
71+ or
72+ exists ( any ( Exprs:: Expr e ) .toString ( ) )
73+ or
74+ exists ( any ( AstExtended:: AstNode n ) .getLocation ( ) )
75+ or
76+ exists ( any ( PyFlow:: BasicBlock b ) .getImmediateDominator ( ) )
77+ or
78+ any ( PyFlow:: BasicBlock b ) .strictlyDominates ( _)
79+ or
80+ any ( PyFlow:: BasicBlock b ) .dominates ( _)
81+ }
82+ }
83+
84+ /**
85+ * The `TypeTracking` stage.
86+ */
87+ cached
88+ module TypeTracking {
89+ /**
90+ * Always holds.
91+ * Ensures that a predicate is evaluated as part of the Ast stage.
92+ */
93+ cached
94+ predicate ref ( ) { 1 = 1 }
95+
96+ private import semmle.python.dataflow.new.DataFlow:: DataFlow as NewDataFlow
97+ private import semmle.python.ApiGraphs:: API as API
98+
99+ /**
100+ * DONT USE!
101+ * Contains references to each predicate that use the above `ref` predicate.
102+ */
103+ cached
104+ predicate backref ( ) {
105+ 1 = 1
106+ or
107+ exists ( any ( NewDataFlow:: TypeTracker t ) .append ( _) )
108+ or
109+ exists ( any ( API:: Node n ) .getAMember ( ) .getAUse ( ) )
64110 }
65111 }
66112
@@ -83,6 +129,7 @@ module Stages {
83129 private import semmle.python.types.Object as TypeObject
84130 private import semmle.python.objects.TObject as TObject
85131 private import semmle.python.Flow as Flow
132+ private import semmle.python.objects.ObjectInternal as ObjectInternal
86133
87134 /**
88135 * DONT USE!
@@ -107,6 +154,8 @@ module Stages {
107154 exists ( TObject:: TObject f )
108155 or
109156 exists ( any ( Flow:: ControlFlowNode c ) .toString ( ) )
157+ or
158+ exists ( any ( ObjectInternal:: ObjectInternal o ) .toString ( ) )
110159 }
111160 }
112161
0 commit comments