@@ -72,16 +72,18 @@ private predicate hasVariableWriteWithCapturedRead(BasicBlock bb, LocalVariable
7272 * Holds if the call `call` at index `i` in basic block `bb` may reach
7373 * a callable that reads captured variable `v`.
7474 */
75- private predicate capturedCallRead ( Call call , BasicBlock bb , int i , LocalVariable v ) {
75+ private predicate capturedCallRead (
76+ CfgNodes:: ExprNodes:: CallCfgNode call , BasicBlock bb , int i , LocalVariable v
77+ ) {
7678 exists ( CfgScope scope |
7779 hasVariableWriteWithCapturedRead ( bb .getAPredecessor * ( ) , v , scope ) and
78- call = bb .getNode ( i ) . getNode ( )
80+ call = bb .getNode ( i )
7981 |
8082 // If the read happens inside a block, we restrict to the call that
8183 // contains the block
8284 not scope instanceof Block
8385 or
84- scope = call .( MethodCall ) .getBlock ( )
86+ scope = call .getExpr ( ) . ( MethodCall ) .getBlock ( )
8587 )
8688}
8789
@@ -148,16 +150,18 @@ private module Cached {
148150 * that writes captured variable `v`.
149151 */
150152 cached
151- predicate capturedCallWrite ( Call call , BasicBlock bb , int i , LocalVariable v ) {
153+ predicate capturedCallWrite (
154+ CfgNodes:: ExprNodes:: CallCfgNode call , BasicBlock bb , int i , LocalVariable v
155+ ) {
152156 exists ( CfgScope scope |
153157 hasVariableReadWithCapturedWrite ( bb .getASuccessor * ( ) , v , scope ) and
154- call = bb .getNode ( i ) . getNode ( )
158+ call = bb .getNode ( i )
155159 |
156160 // If the write happens inside a block, we restrict to the call that
157161 // contains the block
158162 not scope instanceof Block
159163 or
160- scope = call .( MethodCall ) .getBlock ( )
164+ scope = call .getExpr ( ) . ( MethodCall ) .getBlock ( )
161165 )
162166 }
163167
@@ -189,7 +193,7 @@ private module Cached {
189193
190194 pragma [ noinline]
191195 private predicate defReachesCallReadInOuterScope (
192- Definition def , Call call , LocalVariable v , CfgScope scope
196+ Definition def , CfgNodes :: ExprNodes :: CallCfgNode call , LocalVariable v , CfgScope scope
193197 ) {
194198 exists ( BasicBlock bb , int i |
195199 ssaDefReachesRead ( v , def , bb , i ) and
@@ -217,16 +221,16 @@ private module Cached {
217221 * ```
218222 */
219223 cached
220- predicate captureFlowIn ( Definition def , Definition entry ) {
221- exists ( Call call , LocalVariable v , CfgScope scope |
224+ predicate captureFlowIn ( CfgNodes :: ExprNodes :: CallCfgNode call , Definition def , Definition entry ) {
225+ exists ( LocalVariable v , CfgScope scope |
222226 defReachesCallReadInOuterScope ( def , call , v , scope ) and
223227 hasCapturedEntryWrite ( entry , v , scope )
224228 |
225229 // If the read happens inside a block, we restrict to the call that
226230 // contains the block
227231 not scope instanceof Block
228232 or
229- scope = call .( MethodCall ) .getBlock ( )
233+ scope = call .getExpr ( ) . ( MethodCall ) .getBlock ( )
230234 )
231235 }
232236
@@ -242,7 +246,9 @@ private module Cached {
242246 }
243247
244248 pragma [ noinline]
245- private predicate hasCapturedExitRead ( Definition exit , Call call , LocalVariable v , CfgScope scope ) {
249+ private predicate hasCapturedExitRead (
250+ Definition exit , CfgNodes:: ExprNodes:: CallCfgNode call , LocalVariable v , CfgScope scope
251+ ) {
246252 exists ( BasicBlock bb , int i |
247253 capturedCallWrite ( call , bb , i , v ) and
248254 exit .definesAt ( v , bb , i ) and
@@ -261,16 +267,16 @@ private module Cached {
261267 * ```
262268 */
263269 cached
264- predicate captureFlowOut ( Definition def , Definition exit ) {
265- exists ( Call call , LocalVariable v , CfgScope scope |
270+ predicate captureFlowOut ( CfgNodes :: ExprNodes :: CallCfgNode call , Definition def , Definition exit ) {
271+ exists ( LocalVariable v , CfgScope scope |
266272 defReachesExitReadInInnerScope ( def , v , scope ) and
267273 hasCapturedExitRead ( exit , call , v , _)
268274 |
269275 // If the read happens inside a block, we restrict to the call that
270276 // contains the block
271277 not scope instanceof Block
272278 or
273- scope = call .( MethodCall ) .getBlock ( )
279+ scope = call .getExpr ( ) . ( MethodCall ) .getBlock ( )
274280 )
275281 }
276282
0 commit comments