@@ -54,12 +54,7 @@ private module Cached {
54
54
fa .getField ( ) instanceof InstanceField and ia .isImplicitFieldQualifier ( fa )
55
55
)
56
56
} 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
63
58
TFieldValueNode ( Field f )
64
59
65
60
cached
@@ -378,8 +373,7 @@ module Private {
378
373
result .asCallable ( ) = n .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
379
374
result .asCallable ( ) = n .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
380
375
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
383
377
result .asFieldScope ( ) = n .( FieldValueNode ) .getField ( )
384
378
}
385
379
@@ -407,7 +401,7 @@ module Private {
407
401
or
408
402
this = getInstanceArgument ( _)
409
403
or
410
- this .( SummaryNode ) .isArgumentOf ( _, _)
404
+ this .( FlowSummaryNode ) .isArgumentOf ( _, _)
411
405
}
412
406
413
407
/**
@@ -424,7 +418,7 @@ module Private {
424
418
or
425
419
pos = - 1 and this = getInstanceArgument ( call .asCall ( ) )
426
420
or
427
- this .( SummaryNode ) .isArgumentOf ( call , pos )
421
+ this .( FlowSummaryNode ) .isArgumentOf ( call , pos )
428
422
}
429
423
430
424
/** Gets the call in which this node is an argument. */
@@ -435,7 +429,7 @@ module Private {
435
429
class ReturnNode extends Node {
436
430
ReturnNode ( ) {
437
431
exists ( ReturnStmt ret | this .asExpr ( ) = ret .getResult ( ) ) or
438
- this .( SummaryNode ) .isReturn ( )
432
+ this .( FlowSummaryNode ) .isReturn ( )
439
433
}
440
434
441
435
/** Gets the kind of this returned value. */
@@ -447,61 +441,61 @@ module Private {
447
441
OutNode ( ) {
448
442
this .asExpr ( ) instanceof MethodAccess
449
443
or
450
- this .( SummaryNode ) .isOut ( _)
444
+ this .( FlowSummaryNode ) .isOut ( _)
451
445
}
452
446
453
447
/** Gets the underlying call. */
454
448
DataFlowCall getCall ( ) {
455
449
result .asCall ( ) = this .asExpr ( )
456
450
or
457
- this .( SummaryNode ) .isOut ( result )
451
+ this .( FlowSummaryNode ) .isOut ( result )
458
452
}
459
453
}
460
454
461
455
/**
462
456
* A data-flow node used to model flow summaries.
463
457
*/
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 ) }
467
460
468
- SummaryNode ( ) { this = TSummaryInternalNode ( c , state ) }
461
+ SummarizedCallable getSummarizedCallable ( ) {
462
+ result = this .getSummaryNode ( ) .getSummarizedCallable ( )
463
+ }
469
464
470
- override Location getLocation ( ) { result = c .getLocation ( ) }
465
+ override Location getLocation ( ) { result = this . getSummarizedCallable ( ) .getLocation ( ) }
471
466
472
- override string toString ( ) { result = "[summary] " + state + " in " + c }
467
+ override string toString ( ) { result = this . getSummaryNode ( ) . toString ( ) }
473
468
474
469
/** Holds if this summary node is the `i`th argument of `call`. */
475
470
predicate isArgumentOf ( DataFlowCall call , int i ) {
476
- FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this , i )
471
+ FlowSummaryImpl:: Private:: summaryArgumentNode ( call , this . getSummaryNode ( ) , i )
477
472
}
478
473
479
474
/** Holds if this summary node is a return node. */
480
- predicate isReturn ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this , _) }
475
+ predicate isReturn ( ) { FlowSummaryImpl:: Private:: summaryReturnNode ( this . getSummaryNode ( ) , _) }
481
476
482
477
/** 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
+ }
488
481
}
489
482
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
+ }
497
487
498
- override string toString ( ) { result = "[summary param] " + pos_ + " in " + sc }
488
+ private int getPosition ( ) {
489
+ FlowSummaryImpl:: Private:: summaryParameterNode ( this .getSummaryNode ( ) , result )
490
+ }
499
491
500
492
override predicate isParameterOf ( DataFlowCallable c , int pos ) {
501
- c .asSummarizedCallable ( ) = sc and pos = pos_
493
+ c .asSummarizedCallable ( ) = this . getSummarizedCallable ( ) and pos = this . getPosition ( )
502
494
}
503
495
504
- Type getTypeImpl ( ) { result = sc .getParameterType ( pos_ ) }
496
+ Type getTypeImpl ( ) {
497
+ result = this .getSummarizedCallable ( ) .getParameterType ( this .getPosition ( ) )
498
+ }
505
499
}
506
500
}
507
501
@@ -523,10 +517,12 @@ private class MallocNode extends Node, TMallocNode {
523
517
ClassInstanceExpr getClassInstanceExpr ( ) { result = cie }
524
518
}
525
519
526
- private class SummaryPostUpdateNode extends SummaryNode , PostUpdateNode {
527
- private Node pre ;
520
+ private class SummaryPostUpdateNode extends FlowSummaryNode , PostUpdateNode {
521
+ private FlowSummaryNode pre ;
528
522
529
- SummaryPostUpdateNode ( ) { FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this , pre ) }
523
+ SummaryPostUpdateNode ( ) {
524
+ FlowSummaryImpl:: Private:: summaryPostUpdateNode ( this .getSummaryNode ( ) , pre .getSummaryNode ( ) )
525
+ }
530
526
531
527
override Node getPreUpdateNode ( ) { result = pre }
532
528
}
0 commit comments