@@ -112,9 +112,6 @@ private module ImplCommon {
112112 enclosing = arg .getEnclosingCallable ( )
113113 }
114114
115- pragma [ noinline]
116- private ParameterNode getAParameter ( DataFlowCallable c ) { result .getEnclosingCallable ( ) = c }
117-
118115 pragma [ noinline]
119116 private predicate viableParamArg0 (
120117 int i , ArgumentNode arg , CallContext outercc , DataFlowCall call
@@ -123,9 +120,9 @@ private module ImplCommon {
123120 (
124121 outercc = TAnyCallContext ( )
125122 or
126- outercc = TSomeCall ( getAParameter ( c ) , _ )
123+ outercc = TSomeCall ( )
127124 or
128- exists ( DataFlowCall other | outercc = TSpecificCall ( other , _ , _ ) |
125+ exists ( DataFlowCall other | outercc = TSpecificCall ( other ) |
129126 recordDataFlowCallSite ( other , c )
130127 )
131128 ) and
@@ -156,17 +153,17 @@ private module ImplCommon {
156153 viableParamArg1 ( p , callable , i , arg , outercc , call )
157154 |
158155 if recordDataFlowCallSite ( call , callable )
159- then innercc = TSpecificCall ( call , i , true )
160- else innercc = TSomeCall ( p , true )
156+ then innercc = TSpecificCall ( call )
157+ else innercc = TSomeCall ( )
161158 )
162159 }
163160
164161 private CallContextCall getAValidCallContextForParameter ( ParameterNode p ) {
165- result = TSomeCall ( p , _ )
162+ result = TSomeCall ( )
166163 or
167- exists ( DataFlowCall call , int i , DataFlowCallable callable |
168- result = TSpecificCall ( call , i , _ ) and
169- p .isParameterOf ( callable , i ) and
164+ exists ( DataFlowCall call , DataFlowCallable callable |
165+ result = TSpecificCall ( call ) and
166+ p .isParameterOf ( callable , _ ) and
170167 recordDataFlowCallSite ( call , callable )
171168 )
172169 }
@@ -460,9 +457,6 @@ private module ImplCommon {
460457 enclosing = arg .getEnclosingCallable ( )
461458 }
462459
463- pragma [ noinline]
464- private ParameterNode getAParameter ( DataFlowCallable c ) { result .getEnclosingCallable ( ) = c }
465-
466460 pragma [ noinline]
467461 private predicate viableParamArg0 (
468462 int i , ArgumentNode arg , CallContext outercc , DataFlowCall call
@@ -471,9 +465,9 @@ private module ImplCommon {
471465 (
472466 outercc = TAnyCallContext ( )
473467 or
474- outercc = TSomeCall ( getAParameter ( c ) , _ )
468+ outercc = TSomeCall ( )
475469 or
476- exists ( DataFlowCall other | outercc = TSpecificCall ( other , _ , _ ) |
470+ exists ( DataFlowCall other | outercc = TSpecificCall ( other ) |
477471 recordDataFlowCallSite ( other , c )
478472 )
479473 ) and
@@ -504,17 +498,17 @@ private module ImplCommon {
504498 viableParamArg1 ( p , callable , i , arg , outercc , call )
505499 |
506500 if recordDataFlowCallSite ( call , callable )
507- then innercc = TSpecificCall ( call , i , true )
508- else innercc = TSomeCall ( p , true )
501+ then innercc = TSpecificCall ( call )
502+ else innercc = TSomeCall ( )
509503 )
510504 }
511505
512506 private CallContextCall getAValidCallContextForParameter ( ParameterNode p ) {
513- result = TSomeCall ( p , _ )
507+ result = TSomeCall ( )
514508 or
515- exists ( DataFlowCall call , int i , DataFlowCallable callable |
516- result = TSpecificCall ( call , i , _ ) and
517- p .isParameterOf ( callable , i ) and
509+ exists ( DataFlowCall call , DataFlowCallable callable |
510+ result = TSpecificCall ( call ) and
511+ p .isParameterOf ( callable , _ ) and
518512 recordDataFlowCallSite ( call , callable )
519513 )
520514 }
@@ -579,14 +573,6 @@ private module ImplCommon {
579573 }
580574 }
581575
582- /**
583- * Holds if `call` passes an implicit or explicit instance argument, i.e., an
584- * expression that reaches a `this` parameter.
585- */
586- private predicate callHasInstanceArgument ( DataFlowCall call ) {
587- exists ( ArgumentNode arg | arg .argumentOf ( call , - 1 ) )
588- }
589-
590576 /**
591577 * Holds if the call context `call` either improves virtual dispatch in
592578 * `callable` or if it allows us to prune unreachable nodes in `callable`.
@@ -601,16 +587,8 @@ private module ImplCommon {
601587 cached
602588 newtype TCallContext =
603589 TAnyCallContext ( ) or
604- TSpecificCall ( DataFlowCall call , int i , boolean emptyAp ) {
605- recordDataFlowCallSite ( call , _) and
606- ( emptyAp = true or emptyAp = false ) and
607- (
608- exists ( call .getArgument ( i ) )
609- or
610- i = - 1 and callHasInstanceArgument ( call )
611- )
612- } or
613- TSomeCall ( ParameterNode p , boolean emptyAp ) { emptyAp = true or emptyAp = false } or
590+ TSpecificCall ( DataFlowCall call ) { recordDataFlowCallSite ( call , _) } or
591+ TSomeCall ( ) or
614592 TReturn ( DataFlowCallable c , DataFlowCall call ) { reducedViableImplInReturn ( c , call ) }
615593
616594 cached
@@ -635,11 +613,11 @@ private module ImplCommon {
635613 *
636614 * There are four cases:
637615 * - `TAnyCallContext()` : No restrictions on method flow.
638- * - `TSpecificCall(DataFlowCall call, int i )` : Flow entered through the `i`th
639- * parameter at the given `call`. This call improves the set of viable
616+ * - `TSpecificCall(DataFlowCall call)` : Flow entered through the
617+ * given `call`. This call improves the set of viable
640618 * dispatch targets for at least one method call in the current callable
641619 * or helps prune unreachable nodes in the current callable.
642- * - `TSomeCall(ParameterNode p )` : Flow entered through parameter `p` . The
620+ * - `TSomeCall()` : Flow entered through a parameter . The
643621 * originating call does not improve the set of dispatch targets for any
644622 * method call in the current callable and was therefore not recorded.
645623 * - `TReturn(Callable c, DataFlowCall call)` : Flow reached `call` from `c` and
@@ -663,23 +641,23 @@ private module ImplCommon {
663641
664642 class CallContextSpecificCall extends CallContextCall , TSpecificCall {
665643 override string toString ( ) {
666- exists ( DataFlowCall call , int i | this = TSpecificCall ( call , i , _ ) |
667- result = "CcCall(" + call + ", " + i + " )"
644+ exists ( DataFlowCall call | this = TSpecificCall ( call ) |
645+ result = "CcCall(" + call + ")"
668646 )
669647 }
670648
671649 override predicate relevantFor ( DataFlowCallable callable ) {
672650 recordDataFlowCallSite ( getCall ( ) , callable )
673651 }
674652
675- DataFlowCall getCall ( ) { this = TSpecificCall ( result , _ , _ ) }
653+ DataFlowCall getCall ( ) { this = TSpecificCall ( result ) }
676654 }
677655
678656 class CallContextSomeCall extends CallContextCall , TSomeCall {
679657 override string toString ( ) { result = "CcSomeCall" }
680658
681659 override predicate relevantFor ( DataFlowCallable callable ) {
682- exists ( ParameterNode p | this = TSomeCall ( p , _ ) and p .getEnclosingCallable ( ) = callable )
660+ exists ( ParameterNode p | p .getEnclosingCallable ( ) = callable )
683661 }
684662 }
685663
@@ -848,7 +826,7 @@ private module ImplCommon {
848826
849827 bindingset [ call, cc]
850828 DataFlowCallable resolveCall ( DataFlowCall call , CallContext cc ) {
851- exists ( DataFlowCall ctx | cc = TSpecificCall ( ctx , _ , _ ) |
829+ exists ( DataFlowCall ctx | cc = TSpecificCall ( ctx ) |
852830 if reducedViableImplInCallContext ( call , _, ctx )
853831 then result = prunedViableImplInCallContext ( call , ctx )
854832 else result = viableCallable ( call )
0 commit comments