@@ -3854,24 +3854,30 @@ class PathNode extends TPathNode {
3854
3854
/** Gets the associated configuration. */
3855
3855
Configuration getConfiguration ( ) { none ( ) }
3856
3856
3857
- private PathNode getASuccessorIfHidden ( ) {
3858
- this .( PathNodeImpl ) .isHidden ( ) and
3859
- result = this .( PathNodeImpl ) .getASuccessorImpl ( )
3860
- }
3861
-
3862
3857
/** Gets a successor of this node, if any. */
3863
3858
final PathNode getASuccessor ( ) {
3864
- result = this .( PathNodeImpl ) .getASuccessorImpl ( ) . getASuccessorIfHidden * ( ) and
3865
- not this . ( PathNodeImpl ) . isHidden ( ) and
3866
- not result . ( PathNodeImpl ) . isHidden ( )
3859
+ result = this .( PathNodeImpl ) .getANonHiddenSuccessor ( ) and
3860
+ reach ( this ) and
3861
+ reach ( result )
3867
3862
}
3868
3863
3869
3864
/** Holds if this node is a source. */
3870
3865
predicate isSource ( ) { none ( ) }
3871
3866
}
3872
3867
3873
3868
abstract private class PathNodeImpl extends PathNode {
3874
- abstract PathNode getASuccessorImpl ( ) ;
3869
+ abstract PathNodeImpl getASuccessorImpl ( ) ;
3870
+
3871
+ private PathNodeImpl getASuccessorIfHidden ( ) {
3872
+ this .isHidden ( ) and
3873
+ result = this .getASuccessorImpl ( )
3874
+ }
3875
+
3876
+ final PathNodeImpl getANonHiddenSuccessor ( ) {
3877
+ result = this .getASuccessorImpl ( ) .getASuccessorIfHidden * ( ) and
3878
+ not this .isHidden ( ) and
3879
+ not result .isHidden ( )
3880
+ }
3875
3881
3876
3882
abstract NodeEx getNodeEx ( ) ;
3877
3883
@@ -3914,15 +3920,17 @@ abstract private class PathNodeImpl extends PathNode {
3914
3920
}
3915
3921
3916
3922
/** Holds if `n` can reach a sink. */
3917
- private predicate directReach ( PathNode n ) {
3918
- n instanceof PathNodeSink or directReach ( n .getASuccessor ( ) )
3923
+ private predicate directReach ( PathNodeImpl n ) {
3924
+ n instanceof PathNodeSink or directReach ( n .getANonHiddenSuccessor ( ) )
3919
3925
}
3920
3926
3921
3927
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
3922
3928
private predicate reach ( PathNode n ) { directReach ( n ) or Subpaths:: retReach ( n ) }
3923
3929
3924
3930
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
3925
- private predicate pathSucc ( PathNode n1 , PathNode n2 ) { n1 .getASuccessor ( ) = n2 and directReach ( n2 ) }
3931
+ private predicate pathSucc ( PathNodeImpl n1 , PathNode n2 ) {
3932
+ n1 .getANonHiddenSuccessor ( ) = n2 and directReach ( n2 )
3933
+ }
3926
3934
3927
3935
private predicate pathSuccPlus ( PathNode n1 , PathNode n2 ) = fastTC( pathSucc / 2 ) ( n1 , n2 )
3928
3936
@@ -3931,7 +3939,7 @@ private predicate pathSuccPlus(PathNode n1, PathNode n2) = fastTC(pathSucc/2)(n1
3931
3939
*/
3932
3940
module PathGraph {
3933
3941
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
3934
- query predicate edges ( PathNode a , PathNode b ) { a .getASuccessor ( ) = b and reach ( a ) and reach ( b ) }
3942
+ query predicate edges ( PathNode a , PathNode b ) { a .getASuccessor ( ) = b }
3935
3943
3936
3944
/** Holds if `n` is a node in the graph of data flow path explanations. */
3937
3945
query predicate nodes ( PathNode n , string key , string val ) {
@@ -4049,7 +4057,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
4049
4057
4050
4058
override Configuration getConfiguration ( ) { result = config }
4051
4059
4052
- override PathNode getASuccessorImpl ( ) { none ( ) }
4060
+ override PathNodeImpl getASuccessorImpl ( ) { none ( ) }
4053
4061
4054
4062
override predicate isSource ( ) { sourceNode ( node , state , config ) }
4055
4063
}
@@ -4365,8 +4373,8 @@ private module Subpaths {
4365
4373
}
4366
4374
4367
4375
pragma [ nomagic]
4368
- private predicate hasSuccessor ( PathNode pred , PathNodeMid succ , NodeEx succNode ) {
4369
- succ = pred .getASuccessor ( ) and
4376
+ private predicate hasSuccessor ( PathNodeImpl pred , PathNodeMid succ , NodeEx succNode ) {
4377
+ succ = pred .getANonHiddenSuccessor ( ) and
4370
4378
succNode = succ .getNodeEx ( )
4371
4379
}
4372
4380
@@ -4375,9 +4383,9 @@ private module Subpaths {
4375
4383
* a subpath between `par` and `ret` with the connecting edges `arg -> par` and
4376
4384
* `ret -> out` is summarized as the edge `arg -> out`.
4377
4385
*/
4378
- predicate subpaths ( PathNode arg , PathNodeImpl par , PathNodeImpl ret , PathNode out ) {
4386
+ predicate subpaths ( PathNodeImpl arg , PathNodeImpl par , PathNodeImpl ret , PathNode out ) {
4379
4387
exists ( ParamNodeEx p , NodeEx o , FlowState sout , AccessPath apout , PathNodeMid out0 |
4380
- pragma [ only_bind_into ] ( arg ) .getASuccessor ( ) = pragma [ only_bind_into ] ( out0 ) and
4388
+ pragma [ only_bind_into ] ( arg ) .getANonHiddenSuccessor ( ) = pragma [ only_bind_into ] ( out0 ) and
4381
4389
subpaths03 ( pragma [ only_bind_into ] ( arg ) , p , localStepToHidden * ( ret ) , o , sout , apout ) and
4382
4390
hasSuccessor ( pragma [ only_bind_into ] ( arg ) , par , p ) and
4383
4391
not ret .isHidden ( ) and
@@ -4390,12 +4398,12 @@ private module Subpaths {
4390
4398
/**
4391
4399
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
4392
4400
*/
4393
- predicate retReach ( PathNode n ) {
4401
+ predicate retReach ( PathNodeImpl n ) {
4394
4402
exists ( PathNode out | subpaths ( _, _, n , out ) | directReach ( out ) or retReach ( out ) )
4395
4403
or
4396
- exists ( PathNode mid |
4404
+ exists ( PathNodeImpl mid |
4397
4405
retReach ( mid ) and
4398
- n .getASuccessor ( ) = mid and
4406
+ n .getANonHiddenSuccessor ( ) = mid and
4399
4407
not subpaths ( _, mid , _, _)
4400
4408
)
4401
4409
}
0 commit comments