@@ -90,16 +90,11 @@ private module Cached {
90
90
TPatternNode ( CfgNode n , Pattern p ) { hasPatternNode ( n , p ) } or
91
91
TSsaDefinitionNode ( Ssa:: Definition def ) or
92
92
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
96
94
TSourceParameterNode ( ParamDecl param ) or
97
95
TKeyPathParameterNode ( EntryNode entry ) { entry .getScope ( ) instanceof KeyPathExpr } or
98
96
TKeyPathReturnNode ( ExitNode exit ) { exit .getScope ( ) instanceof KeyPathExpr } or
99
97
TKeyPathComponentNode ( KeyPathComponent component ) or
100
- TSummaryParameterNode ( FlowSummary:: SummarizedCallable c , ParameterPosition pos ) {
101
- FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
102
- } or
103
98
TExprPostUpdateNode ( CfgNode n ) {
104
99
// Obviously, the base of setters needs a post-update node
105
100
n = any ( PropertySetterCfgNode setter ) .getBase ( )
@@ -223,7 +218,8 @@ private module Cached {
223
218
nodeFrom .( KeyPathParameterNode ) .getComponent ( 0 )
224
219
or
225
220
// 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 )
227
223
}
228
224
229
225
/**
@@ -318,22 +314,19 @@ private module ParameterNodes {
318
314
override ParamDecl getParameter ( ) { result = param }
319
315
}
320
316
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
+ }
324
321
325
- SummaryParameterNode ( ) { this = TSummaryParameterNode ( sc , pos ) }
322
+ private ParameterPosition getPosition ( ) {
323
+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , result )
324
+ }
326
325
327
326
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 ( )
330
329
}
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 , _) }
337
330
}
338
331
339
332
class KeyPathParameterNode extends ParameterNodeImpl , TKeyPathParameterNode {
@@ -362,17 +355,20 @@ private module ParameterNodes {
362
355
import ParameterNodes
363
356
364
357
/** 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 ) }
368
360
369
- SummaryNode ( ) { this = TSummaryNode ( c , state ) }
361
+ FlowSummary:: SummarizedCallable getSummarizedCallable ( ) {
362
+ result = this .getSummaryNode ( ) .getSummarizedCallable ( )
363
+ }
370
364
371
- override DataFlowCallable getEnclosingCallable ( ) { result .asSummarizedCallable ( ) = c }
365
+ override DataFlowCallable getEnclosingCallable ( ) {
366
+ result .asSummarizedCallable ( ) = this .getSummarizedCallable ( )
367
+ }
372
368
373
- override UnknownLocation getLocationImpl ( ) { any ( ) }
369
+ override Location getLocationImpl ( ) { result = this . getSummarizedCallable ( ) . getLocation ( ) }
374
370
375
- override string toStringImpl ( ) { result = "[summary] " + state + " in " + c }
371
+ override string toStringImpl ( ) { result = this . getSummaryNode ( ) . toString ( ) }
376
372
}
377
373
378
374
/** A data-flow node that represents a call argument. */
@@ -448,11 +444,13 @@ private module ArgumentNodes {
448
444
}
449
445
}
450
446
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
+ }
453
451
454
452
override predicate argumentOf ( DataFlowCall call , ArgumentPosition pos ) {
455
- FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this , pos )
453
+ FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this . getSummaryNode ( ) , pos )
456
454
}
457
455
}
458
456
@@ -521,10 +519,10 @@ private module ReturnNodes {
521
519
override string toStringImpl ( ) { result = param .toString ( ) + "[return]" }
522
520
}
523
521
524
- private class SummaryReturnNode extends SummaryNode , ReturnNode {
522
+ private class SummaryReturnNode extends FlowSummaryNode , ReturnNode {
525
523
private ReturnKind rk ;
526
524
527
- SummaryReturnNode ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this , rk ) }
525
+ SummaryReturnNode ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this . getSummaryNode ( ) , rk ) }
528
526
529
527
override ReturnKind getKind ( ) { result = rk }
530
528
}
@@ -577,11 +575,11 @@ private module OutNodes {
577
575
}
578
576
}
579
577
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 ( ) , _) }
582
580
583
581
override DataFlowCall getCall ( ReturnKind kind ) {
584
- FlowSummaryImpl:: Private:: summaryOutNode ( result , this , kind )
582
+ FlowSummaryImpl:: Private:: summaryOutNode ( result , this . getSummaryNode ( ) , kind )
585
583
}
586
584
}
587
585
@@ -642,7 +640,8 @@ private module OutNodes {
642
640
import OutNodes
643
641
644
642
predicate jumpStep ( Node pred , Node succ ) {
645
- FlowSummaryImpl:: Private:: Steps:: summaryJumpStep ( pred , succ )
643
+ FlowSummaryImpl:: Private:: Steps:: summaryJumpStep ( pred .( FlowSummaryNode ) .getSummaryNode ( ) ,
644
+ succ .( FlowSummaryNode ) .getSummaryNode ( ) )
646
645
}
647
646
648
647
predicate storeStep ( Node node1 , ContentSet c , Node node2 ) {
@@ -692,7 +691,8 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
692
691
init .isFailable ( )
693
692
)
694
693
or
695
- FlowSummaryImpl:: Private:: Steps:: summaryStoreStep ( node1 , c , node2 )
694
+ FlowSummaryImpl:: Private:: Steps:: summaryStoreStep ( node1 .( FlowSummaryNode ) .getSummaryNode ( ) , c ,
695
+ node2 .( FlowSummaryNode ) .getSummaryNode ( ) )
696
696
}
697
697
698
698
predicate isLValue ( Expr e ) { any ( AssignExpr assign ) .getDest ( ) = e }
@@ -830,11 +830,14 @@ private module PostUpdateNodes {
830
830
override DataFlowCallable getEnclosingCallable ( ) { result = TDataFlowFunc ( n .getScope ( ) ) }
831
831
}
832
832
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
+ }
835
837
836
838
override Node getPreUpdateNode ( ) {
837
- FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this , result )
839
+ FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this .getSummaryNode ( ) ,
840
+ result .( FlowSummaryNode ) .getSummaryNode ( ) )
838
841
}
839
842
}
840
843
}
@@ -883,7 +886,7 @@ predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) {
883
886
receiver .asExpr ( ) = call .asCall ( ) .getExpr ( ) .( ApplyExpr ) .getFunction ( )
884
887
or
885
888
kind = TLambdaCallKind ( ) and
886
- receiver = call .( SummaryCall ) .getReceiver ( )
889
+ receiver . ( FlowSummaryNode ) . getSummaryNode ( ) = call .( SummaryCall ) .getReceiver ( )
887
890
or
888
891
kind = TLambdaCallKind ( ) and
889
892
receiver .asExpr ( ) = call .asKeyPath ( ) .getExpr ( ) .( KeyPathApplicationExpr ) .getKeyPath ( )
0 commit comments