@@ -54,12 +54,7 @@ private module Cached {
5454 fa .getField ( ) instanceof InstanceField and ia .isImplicitFieldQualifier ( fa )
5555 )
5656 } or
57- TSummaryInternalNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
58- FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
59- } or
60- TSummaryParameterNode ( SummarizedCallable c , int pos ) {
61- FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
62- } or
57+ TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) or
6358 TFieldValueNode ( Field f )
6459
6560 cached
@@ -378,8 +373,7 @@ module Private {
378373 result .asCallable ( ) = n .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
379374 result .asCallable ( ) = n .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
380375 result = nodeGetEnclosingCallable ( n .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) ) or
381- n = TSummaryInternalNode ( result .asSummarizedCallable ( ) , _) or
382- n = TSummaryParameterNode ( result .asSummarizedCallable ( ) , _) or
376+ result .asSummarizedCallable ( ) = n .( FlowSummaryNode ) .getSummarizedCallable ( ) or
383377 result .asFieldScope ( ) = n .( FieldValueNode ) .getField ( )
384378 }
385379
@@ -407,7 +401,7 @@ module Private {
407401 or
408402 this = getInstanceArgument ( _)
409403 or
410- this .( SummaryNode ) .isArgumentOf ( _, _)
404+ this .( FlowSummaryNode ) .isArgumentOf ( _, _)
411405 }
412406
413407 /**
@@ -424,7 +418,7 @@ module Private {
424418 or
425419 pos = - 1 and this = getInstanceArgument ( call .asCall ( ) )
426420 or
427- this .( SummaryNode ) .isArgumentOf ( call , pos )
421+ this .( FlowSummaryNode ) .isArgumentOf ( call , pos )
428422 }
429423
430424 /** Gets the call in which this node is an argument. */
@@ -435,7 +429,7 @@ module Private {
435429 class ReturnNode extends Node {
436430 ReturnNode ( ) {
437431 exists ( ReturnStmt ret | this .asExpr ( ) = ret .getResult ( ) ) or
438- this .( SummaryNode ) .isReturn ( )
432+ this .( FlowSummaryNode ) .isReturn ( )
439433 }
440434
441435 /** Gets the kind of this returned value. */
@@ -447,61 +441,61 @@ module Private {
447441 OutNode ( ) {
448442 this .asExpr ( ) instanceof MethodAccess
449443 or
450- this .( SummaryNode ) .isOut ( _)
444+ this .( FlowSummaryNode ) .isOut ( _)
451445 }
452446
453447 /** Gets the underlying call. */
454448 DataFlowCall getCall ( ) {
455449 result .asCall ( ) = this .asExpr ( )
456450 or
457- this .( SummaryNode ) .isOut ( result )
451+ this .( FlowSummaryNode ) .isOut ( result )
458452 }
459453 }
460454
461455 /**
462456 * A data-flow node used to model flow summaries.
463457 */
464- class SummaryNode extends Node , TSummaryInternalNode {
465- private SummarizedCallable c ;
466- private FlowSummaryImpl:: Private:: SummaryNodeState state ;
458+ class FlowSummaryNode extends Node , TFlowSummaryNode {
459+ FlowSummaryImpl:: Private:: SummaryNode getSummaryNode ( ) { this = TFlowSummaryNode ( result ) }
467460
468- SummaryNode ( ) { this = TSummaryInternalNode ( c , state ) }
461+ SummarizedCallable getSummarizedCallable ( ) {
462+ result = this .getSummaryNode ( ) .getSummarizedCallable ( )
463+ }
469464
470- override Location getLocation ( ) { result = c .getLocation ( ) }
465+ override Location getLocation ( ) { result = this . getSummarizedCallable ( ) .getLocation ( ) }
471466
472- override string toString ( ) { result = "[summary] " + state + " in " + c }
467+ override string toString ( ) { result = this . getSummaryNode ( ) . toString ( ) }
473468
474469 /** Holds if this summary node is the `i`th argument of `call`. */
475470 predicate isArgumentOf ( DataFlowCall call , int i ) {
476- FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this , i )
471+ FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this . getSummaryNode ( ) , i )
477472 }
478473
479474 /** Holds if this summary node is a return node. */
480- predicate isReturn ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this , _) }
475+ predicate isReturn ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this . getSummaryNode ( ) , _) }
481476
482477 /** Holds if this summary node is an out node for `call`. */
483- predicate isOut ( DataFlowCall call ) { FlowSummaryImpl:: Private:: summaryOutNode ( call , this , _) }
484- }
485-
486- SummaryNode getSummaryNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
487- result = TSummaryInternalNode ( c , state )
478+ predicate isOut ( DataFlowCall call ) {
479+ FlowSummaryImpl:: Private:: summaryOutNode ( call , this .getSummaryNode ( ) , _)
480+ }
488481 }
489482
490- class SummaryParameterNode extends ParameterNode , TSummaryParameterNode {
491- private SummarizedCallable sc ;
492- private int pos_ ;
493-
494- SummaryParameterNode ( ) { this = TSummaryParameterNode ( sc , pos_ ) }
495-
496- override Location getLocation ( ) { result = sc .getLocation ( ) }
483+ class SummaryParameterNode extends ParameterNode , FlowSummaryNode {
484+ SummaryParameterNode ( ) {
485+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , _)
486+ }
497487
498- override string toString ( ) { result = "[summary param] " + pos_ + " in " + sc }
488+ private int getPosition ( ) {
489+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , result )
490+ }
499491
500492 override predicate isParameterOf ( DataFlowCallable c , int pos ) {
501- c .asSummarizedCallable ( ) = sc and pos = pos_
493+ c .asSummarizedCallable ( ) = this . getSummarizedCallable ( ) and pos = this . getPosition ( )
502494 }
503495
504- Type getTypeImpl ( ) { result = sc .getParameterType ( pos_ ) }
496+ Type getTypeImpl ( ) {
497+ result = this .getSummarizedCallable ( ) .getParameterType ( this .getPosition ( ) )
498+ }
505499 }
506500}
507501
@@ -523,10 +517,12 @@ private class MallocNode extends Node, TMallocNode {
523517 ClassInstanceExpr getClassInstanceExpr ( ) { result = cie }
524518}
525519
526- private class SummaryPostUpdateNode extends SummaryNode , PostUpdateNode {
527- private Node pre ;
520+ private class SummaryPostUpdateNode extends FlowSummaryNode , PostUpdateNode {
521+ private FlowSummaryNode pre ;
528522
529- SummaryPostUpdateNode ( ) { FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this , pre ) }
523+ SummaryPostUpdateNode ( ) {
524+ FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this .getSummaryNode ( ) , pre .getSummaryNode ( ) )
525+ }
530526
531527 override Node getPreUpdateNode ( ) { result = pre }
532528}
0 commit comments