@@ -30,11 +30,6 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
30
30
* A Callable.
31
31
*/
32
32
class Callable {
33
- /**
34
- * Gets the number of parameters of this callable.
35
- */
36
- int getNumberOfParameters ( ) ;
37
-
38
33
/**
39
34
* Gets a string representation of this callable.
40
35
*/
@@ -626,28 +621,35 @@ module MakeModelGenerator<
626
621
/**
627
622
* A class of APIs relevant for modeling using content flow.
628
623
* The following heuristic is applied:
629
- * Content flow is only relevant for an API, if
630
- * #content flow <= 2 * #parameters + 3
631
- * If an API produces more content flow, it is likely that
632
- * 1. Types are not sufficiently constrained leading to a combinatorial
624
+ * Content flow is only relevant for an API on a parameter , if
625
+ * #content flow from parameter <= 3
626
+ * If an API produces more content flow on a parameter , it is likely that
627
+ * 1. Types are not sufficiently constrained on the parameter leading to a combinatorial
633
628
* explosion in dispatch and thus in the generated summaries.
634
629
* 2. It is a reasonable approximation to use the non-content based flow
635
630
* detection instead, as reads and stores would use a significant
636
631
* part of an objects internal state.
637
632
*/
638
633
private class ContentDataFlowSummaryTargetApi extends DataFlowSummaryTargetApi {
634
+ private DataFlow:: ParameterNode parameter ;
635
+
639
636
ContentDataFlowSummaryTargetApi ( ) {
640
637
count ( string input , string output |
641
638
exists (
642
- DataFlow :: ParameterNode p , PropagateContentFlow:: AccessPath reads ,
643
- ReturnNodeExt returnNodeExt , PropagateContentFlow:: AccessPath stores
639
+ PropagateContentFlow:: AccessPath reads , ReturnNodeExt returnNodeExt ,
640
+ PropagateContentFlow:: AccessPath stores
644
641
|
645
- apiFlow ( this , p , reads , returnNodeExt , stores , _) and
646
- input = parameterNodeAsContentInput ( p ) + printReadAccessPath ( reads ) and
642
+ apiFlow ( this , parameter , reads , returnNodeExt , stores , _) and
643
+ input = parameterNodeAsContentInput ( parameter ) + printReadAccessPath ( reads ) and
647
644
output = getContentOutput ( returnNodeExt ) + printStoreAccessPath ( stores )
648
645
)
649
- ) <= 2 * this . getNumberOfParameters ( ) + 3
646
+ ) <= 3
650
647
}
648
+
649
+ /**
650
+ * Gets a parameter node of `this` api, where there are less than 3 possible models, if any.
651
+ */
652
+ DataFlow:: ParameterNode getARelevantParameterNode ( ) { result = parameter }
651
653
}
652
654
653
655
pragma [ nomagic]
@@ -658,7 +660,8 @@ module MakeModelGenerator<
658
660
) {
659
661
PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
660
662
returnNodeExt .getEnclosingCallable ( ) = api and
661
- p .( NodeExtended ) .getEnclosingCallable ( ) = api
663
+ p .( NodeExtended ) .getEnclosingCallable ( ) = api and
664
+ p = api .getARelevantParameterNode ( )
662
665
}
663
666
664
667
/**
0 commit comments