@@ -228,7 +228,7 @@ private module SsaImpl {
228
228
/** Holds if `n` must update the locally tracked variable `v`. */
229
229
cached
230
230
predicate certainVariableUpdate ( TrackedVar v , ControlFlowNode n , BasicBlock b , int i ) {
231
- exists ( VariableUpdate a | a = n | getDestVar ( a ) = v ) and
231
+ exists ( VariableUpdate a | a . getControlFlowNode ( ) = n | getDestVar ( a ) = v ) and
232
232
b .getNode ( i ) = n and
233
233
hasDominanceInformation ( b )
234
234
or
@@ -237,8 +237,8 @@ private module SsaImpl {
237
237
238
238
/** Gets the definition point of a nested class in the parent scope. */
239
239
private ControlFlowNode parentDef ( NestedClass nc ) {
240
- nc .( AnonymousClass ) .getClassInstanceExpr ( ) = result or
241
- nc .( LocalClass ) .getLocalTypeDeclStmt ( ) = result
240
+ nc .( AnonymousClass ) .getClassInstanceExpr ( ) . getControlFlowNode ( ) = result or
241
+ nc .( LocalClass ) .getLocalTypeDeclStmt ( ) . getControlFlowNode ( ) = result
242
242
}
243
243
244
244
/**
@@ -276,7 +276,7 @@ private module SsaImpl {
276
276
277
277
/** Holds if `VarAccess` `use` of `v` occurs in `b` at index `i`. */
278
278
private predicate variableUse ( TrackedVar v , VarRead use , BasicBlock b , int i ) {
279
- v .getAnAccess ( ) = use and b .getNode ( i ) = use
279
+ v .getAnAccess ( ) = use and b .getNode ( i ) = use . getControlFlowNode ( )
280
280
}
281
281
282
282
/** Holds if the value of `v` is captured in `b` at index `i`. */
@@ -423,7 +423,7 @@ private module SsaImpl {
423
423
* `f` has an update somewhere.
424
424
*/
425
425
private predicate updateCandidate ( TrackedField f , Call call , BasicBlock b , int i ) {
426
- b .getNode ( i ) = call and
426
+ b .getNode ( i ) . asCall ( ) = call and
427
427
call .getEnclosingCallable ( ) = f .getEnclosingCallable ( ) and
428
428
relevantFieldUpdate ( _, f .getField ( ) , _)
429
429
}
@@ -550,7 +550,7 @@ private module SsaImpl {
550
550
/** Holds if `n` might update the locally tracked variable `v`. */
551
551
cached
552
552
predicate uncertainVariableUpdate ( TrackedVar v , ControlFlowNode n , BasicBlock b , int i ) {
553
- exists ( Call c | c = n | updatesNamedField ( c , v , _) ) and
553
+ exists ( Call c | c = n . asCall ( ) | updatesNamedField ( c , v , _) ) and
554
554
b .getNode ( i ) = n and
555
555
hasDominanceInformation ( b )
556
556
or
@@ -574,12 +574,16 @@ private module SsaImpl {
574
574
/** Holds if `v` has an implicit definition at the entry, `b`, of the callable. */
575
575
cached
576
576
predicate hasEntryDef ( TrackedVar v , BasicBlock b ) {
577
- exists ( LocalScopeVariable l , Callable c | v = TLocalVar ( c , l ) and c .getBody ( ) = b |
577
+ exists ( LocalScopeVariable l , Callable c |
578
+ v = TLocalVar ( c , l ) and c .getBody ( ) .getControlFlowNode ( ) = b
579
+ |
578
580
l instanceof Parameter or
579
581
l .getCallable ( ) != c
580
582
)
581
583
or
582
- v instanceof SsaSourceField and v .getEnclosingCallable ( ) .getBody ( ) = b and liveAtEntry ( v , b )
584
+ v instanceof SsaSourceField and
585
+ v .getEnclosingCallable ( ) .getBody ( ) .getControlFlowNode ( ) = b and
586
+ liveAtEntry ( v , b )
583
587
}
584
588
585
589
/**
@@ -882,7 +886,7 @@ private newtype TSsaVariable =
882
886
} or
883
887
TSsaEntryDef ( TrackedVar v , BasicBlock b ) { hasEntryDef ( v , b ) } or
884
888
TSsaUntracked ( SsaSourceField nf , ControlFlowNode n ) {
885
- n = nf .getAnAccess ( ) .( FieldRead ) and not trackField ( nf )
889
+ n = nf .getAnAccess ( ) .( FieldRead ) . getControlFlowNode ( ) and not trackField ( nf )
886
890
}
887
891
888
892
/**
@@ -940,7 +944,7 @@ class SsaVariable extends TSsaVariable {
940
944
/** Gets an access of this SSA variable. */
941
945
VarRead getAUse ( ) {
942
946
ssaDefReachesUse ( _, this , result ) or
943
- this = TSsaUntracked ( _, result )
947
+ this = TSsaUntracked ( _, result . getControlFlowNode ( ) )
944
948
}
945
949
946
950
/**
@@ -954,7 +958,7 @@ class SsaVariable extends TSsaVariable {
954
958
*/
955
959
VarRead getAFirstUse ( ) {
956
960
firstUse ( this , result ) or
957
- this = TSsaUntracked ( _, result )
961
+ this = TSsaUntracked ( _, result . getControlFlowNode ( ) )
958
962
}
959
963
960
964
/** Holds if this SSA variable is live at the end of `b`. */
@@ -990,15 +994,16 @@ class SsaUpdate extends SsaVariable {
990
994
class SsaExplicitUpdate extends SsaUpdate , TSsaCertainUpdate {
991
995
SsaExplicitUpdate ( ) {
992
996
exists ( VariableUpdate upd |
993
- upd = this .getCfgNode ( ) and getDestVar ( upd ) = this .getSourceVariable ( )
997
+ upd . getControlFlowNode ( ) = this .getCfgNode ( ) and getDestVar ( upd ) = this .getSourceVariable ( )
994
998
)
995
999
}
996
1000
997
1001
override string toString ( ) { result = "SSA def(" + this .getSourceVariable ( ) + ")" }
998
1002
999
1003
/** Gets the `VariableUpdate` defining the SSA variable. */
1000
1004
VariableUpdate getDefiningExpr ( ) {
1001
- result = this .getCfgNode ( ) and getDestVar ( result ) = this .getSourceVariable ( )
1005
+ result .getControlFlowNode ( ) = this .getCfgNode ( ) and
1006
+ getDestVar ( result ) = this .getSourceVariable ( )
1002
1007
}
1003
1008
}
1004
1009
@@ -1038,7 +1043,7 @@ class SsaImplicitUpdate extends SsaUpdate {
1038
1043
exists ( SsaSourceField f , Callable setter |
1039
1044
f = this .getSourceVariable ( ) and
1040
1045
relevantFieldUpdate ( setter , f .getField ( ) , result ) and
1041
- updatesNamedField ( this .getCfgNode ( ) , f , setter )
1046
+ updatesNamedField ( this .getCfgNode ( ) . asCall ( ) , f , setter )
1042
1047
)
1043
1048
}
1044
1049
@@ -1086,7 +1091,7 @@ class SsaImplicitInit extends SsaVariable, TSsaEntryDef {
1086
1091
*/
1087
1092
predicate isParameterDefinition ( Parameter p ) {
1088
1093
this .getSourceVariable ( ) = TLocalVar ( p .getCallable ( ) , p ) and
1089
- p .getCallable ( ) .getBody ( ) = this .getCfgNode ( )
1094
+ p .getCallable ( ) .getBody ( ) . getControlFlowNode ( ) = this .getCfgNode ( )
1090
1095
}
1091
1096
}
1092
1097
0 commit comments