@@ -30,11 +30,6 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
3030 * A Callable.
3131 */
3232 class Callable {
33- /**
34- * Gets the number of parameters of this callable.
35- */
36- int getNumberOfParameters ( ) ;
37-
3833 /**
3934 * Gets a string representation of this callable.
4035 */
@@ -626,28 +621,35 @@ module MakeModelGenerator<
626621 /**
627622 * A class of APIs relevant for modeling using content flow.
628623 * 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
633628 * explosion in dispatch and thus in the generated summaries.
634629 * 2. It is a reasonable approximation to use the non-content based flow
635630 * detection instead, as reads and stores would use a significant
636631 * part of an objects internal state.
637632 */
638633 private class ContentDataFlowSummaryTargetApi extends DataFlowSummaryTargetApi {
634+ private DataFlow:: ParameterNode parameter ;
635+
639636 ContentDataFlowSummaryTargetApi ( ) {
640637 count ( string input , string output |
641638 exists (
642- DataFlow :: ParameterNode p , PropagateContentFlow:: AccessPath reads ,
643- ReturnNodeExt returnNodeExt , PropagateContentFlow:: AccessPath stores
639+ PropagateContentFlow:: AccessPath reads , ReturnNodeExt returnNodeExt ,
640+ PropagateContentFlow:: AccessPath stores
644641 |
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
647644 output = getContentOutput ( returnNodeExt ) + printStoreAccessPath ( stores )
648645 )
649- ) <= 2 * this . getNumberOfParameters ( ) + 3
646+ ) <= 3
650647 }
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 }
651653 }
652654
653655 pragma [ nomagic]
@@ -658,7 +660,8 @@ module MakeModelGenerator<
658660 ) {
659661 PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
660662 returnNodeExt .getEnclosingCallable ( ) = api and
661- p .( NodeExtended ) .getEnclosingCallable ( ) = api
663+ p .( NodeExtended ) .getEnclosingCallable ( ) = api and
664+ p = api .getARelevantParameterNode ( )
662665 }
663666
664667 /**
0 commit comments