@@ -44,16 +44,15 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
44
44
* Gets the type of this node.
45
45
*/
46
46
Type getType ( ) ;
47
+ }
47
48
48
- /**
49
- * Gets the enclosing callable of this node.
50
- */
51
- Callable getEnclosingCallable ( ) ;
49
+ /** Gets the enclosing callable of `node`. */
50
+ Callable getEnclosingCallable ( NodeExtended node ) ;
52
51
53
- /**
54
- * Gets the enclosing callable of this node, when considered as an expression.
55
- */
56
- Callable getAsExprEnclosingCallable ( ) ;
52
+ /**
53
+ * Gets the enclosing callable of ` node` , when considered as an expression.
54
+ */
55
+ Callable getAsExprEnclosingCallable ( NodeExtended node ) ;
57
56
58
57
/** Gets the parameter corresponding to this node, if any. */
59
58
Parameter asParameter ( NodeExtended n ) ;
@@ -462,7 +461,7 @@ module MakeModelGenerator<
462
461
predicate isSource ( DataFlow:: Node source , FlowState state ) {
463
462
source instanceof DataFlow:: ParameterNode and
464
463
exists ( Callable c |
465
- c = source . ( NodeExtended ) . getEnclosingCallable ( ) and
464
+ c = getEnclosingCallable ( source ) and
466
465
c instanceof DataFlowSummaryTargetApi and
467
466
not isUninterestingForHeuristicDataFlowModels ( c )
468
467
) and
@@ -472,7 +471,7 @@ module MakeModelGenerator<
472
471
predicate isSink ( DataFlow:: Node sink , FlowState state ) {
473
472
sink instanceof ReturnNodeExt and
474
473
not isOwnInstanceAccessNode ( sink ) and
475
- not exists ( captureQualifierFlow ( sink . ( NodeExtended ) . getAsExprEnclosingCallable ( ) ) ) and
474
+ not exists ( captureQualifierFlow ( getAsExprEnclosingCallable ( sink ) ) ) and
476
475
( state instanceof TaintRead or state instanceof TaintStore )
477
476
}
478
477
@@ -516,8 +515,8 @@ module MakeModelGenerator<
516
515
DataFlowSummaryTargetApi api , DataFlow:: ParameterNode p , ReturnNodeExt returnNodeExt
517
516
) {
518
517
exists ( string input , string output |
519
- p . ( NodeExtended ) . getEnclosingCallable ( ) = api and
520
- returnNodeExt . getEnclosingCallable ( ) = api and
518
+ getEnclosingCallable ( p ) = api and
519
+ getEnclosingCallable ( returnNodeExt ) = api and
521
520
input = parameterNodeAsInput ( p ) and
522
521
output = getOutput ( returnNodeExt ) and
523
522
input != output and
@@ -567,11 +566,12 @@ module MakeModelGenerator<
567
566
private module PropagateContentFlowConfig implements ContentDataFlow:: ConfigSig {
568
567
predicate isSource ( DataFlow:: Node source ) {
569
568
source instanceof DataFlow:: ParameterNode and
570
- source . ( NodeExtended ) . getEnclosingCallable ( ) instanceof DataFlowSummaryTargetApi
569
+ getEnclosingCallable ( source ) instanceof DataFlowSummaryTargetApi
571
570
}
572
571
573
572
predicate isSink ( DataFlow:: Node sink ) {
574
- sink .( ReturnNodeExt ) .getEnclosingCallable ( ) instanceof DataFlowSummaryTargetApi
573
+ sink instanceof ReturnNodeExt and
574
+ getEnclosingCallable ( sink ) instanceof DataFlowSummaryTargetApi
575
575
}
576
576
577
577
predicate isAdditionalFlowStep = isAdditionalContentFlowStep / 2 ;
@@ -664,8 +664,8 @@ module MakeModelGenerator<
664
664
PropagateContentFlow:: AccessPath stores , boolean preservesValue
665
665
) {
666
666
PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
667
- returnNodeExt . getEnclosingCallable ( ) = api and
668
- p . ( NodeExtended ) . getEnclosingCallable ( ) = api
667
+ getEnclosingCallable ( returnNodeExt ) = api and
668
+ getEnclosingCallable ( p ) = api
669
669
}
670
670
671
671
/**
@@ -709,8 +709,8 @@ module MakeModelGenerator<
709
709
PropagateContentFlow:: AccessPath stores , boolean preservesValue
710
710
) {
711
711
PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
712
- returnNodeExt . getEnclosingCallable ( ) = api and
713
- p . ( NodeExtended ) . getEnclosingCallable ( ) = api and
712
+ getEnclosingCallable ( returnNodeExt ) = api and
713
+ getEnclosingCallable ( p ) = api and
714
714
p = api .getARelevantParameterNode ( )
715
715
}
716
716
@@ -982,7 +982,8 @@ module MakeModelGenerator<
982
982
}
983
983
984
984
predicate isSink ( DataFlow:: Node sink ) {
985
- sink .( ReturnNodeExt ) .getEnclosingCallable ( ) instanceof DataFlowSourceTargetApi
985
+ sink instanceof ReturnNodeExt and
986
+ getEnclosingCallable ( sink ) instanceof DataFlowSourceTargetApi
986
987
}
987
988
988
989
DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSinkCallContext }
@@ -1005,8 +1006,8 @@ module MakeModelGenerator<
1005
1006
exists ( NodeExtended source , ReturnNodeExt sink , string kind |
1006
1007
PropagateFromSource:: flow ( source , sink ) and
1007
1008
sourceNode ( source , kind ) and
1008
- api = sink . getEnclosingCallable ( ) and
1009
- not irrelevantSourceSinkApi ( source . getEnclosingCallable ( ) , api ) and
1009
+ api = getEnclosingCallable ( sink ) and
1010
+ not irrelevantSourceSinkApi ( getEnclosingCallable ( source ) , api ) and
1010
1011
result = ModelPrinting:: asSourceModel ( api , getOutput ( sink ) , kind )
1011
1012
)
1012
1013
}
@@ -1021,7 +1022,7 @@ module MakeModelGenerator<
1021
1022
module PropagateToSinkConfig implements DataFlow:: ConfigSig {
1022
1023
predicate isSource ( DataFlow:: Node source ) {
1023
1024
apiSource ( source ) and
1024
- source . ( NodeExtended ) . getEnclosingCallable ( ) instanceof DataFlowSinkTargetApi
1025
+ getEnclosingCallable ( source ) instanceof DataFlowSinkTargetApi
1025
1026
}
1026
1027
1027
1028
predicate isSink ( DataFlow:: Node sink ) {
@@ -1050,7 +1051,7 @@ module MakeModelGenerator<
1050
1051
exists ( NodeExtended src , NodeExtended sink , string kind |
1051
1052
PropagateToSink:: flow ( src , sink ) and
1052
1053
sinkNode ( sink , kind ) and
1053
- api = src . getEnclosingCallable ( ) and
1054
+ api = getEnclosingCallable ( src ) and
1054
1055
result = ModelPrinting:: asSinkModel ( api , asInputArgument ( src ) , kind )
1055
1056
)
1056
1057
}
0 commit comments