@@ -90,16 +90,11 @@ private module Cached {
9090 TPatternNode ( CfgNode n , Pattern p ) { hasPatternNode ( n , p ) } or
9191 TSsaDefinitionNode ( Ssa:: Definition def ) or
9292 TInoutReturnNode ( ParamDecl param ) { modifiableParam ( param ) } or
93- TSummaryNode ( FlowSummary:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
94- FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
95- } or
93+ TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) or
9694 TSourceParameterNode ( ParamDecl param ) or
9795 TKeyPathParameterNode ( EntryNode entry ) { entry .getScope ( ) instanceof KeyPathExpr } or
9896 TKeyPathReturnNode ( ExitNode exit ) { exit .getScope ( ) instanceof KeyPathExpr } or
9997 TKeyPathComponentNode ( KeyPathComponent component ) or
100- TSummaryParameterNode ( FlowSummary:: SummarizedCallable c , ParameterPosition pos ) {
101- FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
102- } or
10398 TExprPostUpdateNode ( CfgNode n ) {
10499 // Obviously, the base of setters needs a post-update node
105100 n = any ( PropertySetterCfgNode setter ) .getBase ( )
@@ -223,7 +218,8 @@ private module Cached {
223218 nodeFrom .( KeyPathParameterNode ) .getComponent ( 0 )
224219 or
225220 // flow through a flow summary (extension of `SummaryModelCsv`)
226- FlowSummaryImpl:: Private:: Steps:: summaryLocalStep ( nodeFrom , nodeTo , true )
221+ FlowSummaryImpl:: Private:: Steps:: summaryLocalStep ( nodeFrom .( FlowSummaryNode ) .getSummaryNode ( ) ,
222+ nodeTo .( FlowSummaryNode ) .getSummaryNode ( ) , true )
227223 }
228224
229225 /**
@@ -318,22 +314,19 @@ private module ParameterNodes {
318314 override ParamDecl getParameter ( ) { result = param }
319315 }
320316
321- class SummaryParameterNode extends ParameterNodeImpl , TSummaryParameterNode {
322- FlowSummary:: SummarizedCallable sc ;
323- ParameterPosition pos ;
317+ class SummaryParameterNode extends ParameterNodeImpl , FlowSummaryNode {
318+ SummaryParameterNode ( ) {
319+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , _)
320+ }
324321
325- SummaryParameterNode ( ) { this = TSummaryParameterNode ( sc , pos ) }
322+ private ParameterPosition getPosition ( ) {
323+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , result )
324+ }
326325
327326 override predicate isParameterOf ( DataFlowCallable c , ParameterPosition p ) {
328- c .getUnderlyingCallable ( ) = sc and
329- p = pos
327+ c .getUnderlyingCallable ( ) = this . getSummarizedCallable ( ) and
328+ p = this . getPosition ( )
330329 }
331-
332- override Location getLocationImpl ( ) { result = sc .getLocation ( ) }
333-
334- override string toStringImpl ( ) { result = "[summary param] " + pos + " in " + sc }
335-
336- override DataFlowCallable getEnclosingCallable ( ) { this .isParameterOf ( result , _) }
337330 }
338331
339332 class KeyPathParameterNode extends ParameterNodeImpl , TKeyPathParameterNode {
@@ -362,17 +355,20 @@ private module ParameterNodes {
362355import ParameterNodes
363356
364357/** A data-flow node used to model flow summaries. */
365- class SummaryNode extends NodeImpl , TSummaryNode {
366- private FlowSummaryImpl:: Public:: SummarizedCallable c ;
367- private FlowSummaryImpl:: Private:: SummaryNodeState state ;
358+ class FlowSummaryNode extends NodeImpl , TFlowSummaryNode {
359+ FlowSummaryImpl:: Private:: SummaryNode getSummaryNode ( ) { this = TFlowSummaryNode ( result ) }
368360
369- SummaryNode ( ) { this = TSummaryNode ( c , state ) }
361+ FlowSummary:: SummarizedCallable getSummarizedCallable ( ) {
362+ result = this .getSummaryNode ( ) .getSummarizedCallable ( )
363+ }
370364
371- override DataFlowCallable getEnclosingCallable ( ) { result .asSummarizedCallable ( ) = c }
365+ override DataFlowCallable getEnclosingCallable ( ) {
366+ result .asSummarizedCallable ( ) = this .getSummarizedCallable ( )
367+ }
372368
373- override UnknownLocation getLocationImpl ( ) { any ( ) }
369+ override Location getLocationImpl ( ) { result = this . getSummarizedCallable ( ) . getLocation ( ) }
374370
375- override string toStringImpl ( ) { result = "[summary] " + state + " in " + c }
371+ override string toStringImpl ( ) { result = this . getSummaryNode ( ) . toString ( ) }
376372}
377373
378374/** A data-flow node that represents a call argument. */
@@ -448,11 +444,13 @@ private module ArgumentNodes {
448444 }
449445 }
450446
451- class SummaryArgumentNode extends SummaryNode , ArgumentNode {
452- SummaryArgumentNode ( ) { FlowSummaryImpl:: Private:: summaryArgumentNode ( _, this , _) }
447+ class SummaryArgumentNode extends FlowSummaryNode , ArgumentNode {
448+ SummaryArgumentNode ( ) {
449+ FlowSummaryImpl:: Private:: summaryArgumentNode ( _, this .getSummaryNode ( ) , _)
450+ }
453451
454452 override predicate argumentOf ( DataFlowCall call , ArgumentPosition pos ) {
455- FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this , pos )
453+ FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this . getSummaryNode ( ) , pos )
456454 }
457455 }
458456
@@ -521,10 +519,10 @@ private module ReturnNodes {
521519 override string toStringImpl ( ) { result = param .toString ( ) + "[return]" }
522520 }
523521
524- private class SummaryReturnNode extends SummaryNode , ReturnNode {
522+ private class SummaryReturnNode extends FlowSummaryNode , ReturnNode {
525523 private ReturnKind rk ;
526524
527- SummaryReturnNode ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this , rk ) }
525+ SummaryReturnNode ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this . getSummaryNode ( ) , rk ) }
528526
529527 override ReturnKind getKind ( ) { result = rk }
530528 }
@@ -577,11 +575,11 @@ private module OutNodes {
577575 }
578576 }
579577
580- class SummaryOutNode extends OutNode , SummaryNode {
581- SummaryOutNode ( ) { FlowSummaryImpl:: Private:: summaryOutNode ( _, this , _) }
578+ class SummaryOutNode extends OutNode , FlowSummaryNode {
579+ SummaryOutNode ( ) { FlowSummaryImpl:: Private:: summaryOutNode ( _, this . getSummaryNode ( ) , _) }
582580
583581 override DataFlowCall getCall ( ReturnKind kind ) {
584- FlowSummaryImpl:: Private:: summaryOutNode ( result , this , kind )
582+ FlowSummaryImpl:: Private:: summaryOutNode ( result , this . getSummaryNode ( ) , kind )
585583 }
586584 }
587585
@@ -642,7 +640,8 @@ private module OutNodes {
642640import OutNodes
643641
644642predicate jumpStep ( Node pred , Node succ ) {
645- FlowSummaryImpl:: Private:: Steps:: summaryJumpStep ( pred , succ )
643+ FlowSummaryImpl:: Private:: Steps:: summaryJumpStep ( pred .( FlowSummaryNode ) .getSummaryNode ( ) ,
644+ succ .( FlowSummaryNode ) .getSummaryNode ( ) )
646645}
647646
648647predicate storeStep ( Node node1 , ContentSet c , Node node2 ) {
@@ -692,7 +691,8 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
692691 init .isFailable ( )
693692 )
694693 or
695- FlowSummaryImpl:: Private:: Steps:: summaryStoreStep ( node1 , c , node2 )
694+ FlowSummaryImpl:: Private:: Steps:: summaryStoreStep ( node1 .( FlowSummaryNode ) .getSummaryNode ( ) , c ,
695+ node2 .( FlowSummaryNode ) .getSummaryNode ( ) )
696696}
697697
698698predicate isLValue ( Expr e ) { any ( AssignExpr assign ) .getDest ( ) = e }
@@ -830,11 +830,14 @@ private module PostUpdateNodes {
830830 override DataFlowCallable getEnclosingCallable ( ) { result = TDataFlowFunc ( n .getScope ( ) ) }
831831 }
832832
833- class SummaryPostUpdateNode extends SummaryNode , PostUpdateNodeImpl {
834- SummaryPostUpdateNode ( ) { FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this , _) }
833+ class SummaryPostUpdateNode extends FlowSummaryNode , PostUpdateNodeImpl {
834+ SummaryPostUpdateNode ( ) {
835+ FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this .getSummaryNode ( ) , _)
836+ }
835837
836838 override Node getPreUpdateNode ( ) {
837- FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this , result )
839+ FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this .getSummaryNode ( ) ,
840+ result .( FlowSummaryNode ) .getSummaryNode ( ) )
838841 }
839842 }
840843}
@@ -883,7 +886,7 @@ predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) {
883886 receiver .asExpr ( ) = call .asCall ( ) .getExpr ( ) .( ApplyExpr ) .getFunction ( )
884887 or
885888 kind = TLambdaCallKind ( ) and
886- receiver = call .( SummaryCall ) .getReceiver ( )
889+ receiver . ( FlowSummaryNode ) . getSummaryNode ( ) = call .( SummaryCall ) .getReceiver ( )
887890 or
888891 kind = TLambdaCallKind ( ) and
889892 receiver .asExpr ( ) = call .asKeyPath ( ) .getExpr ( ) .( KeyPathApplicationExpr ) .getKeyPath ( )
0 commit comments