@@ -97,15 +97,22 @@ module SsaFlow {
9797 or
9898 result .( Impl:: ExprPostUpdateNode ) .getExpr ( ) = n .( PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( )
9999 or
100- n = toParameterNode ( result .( Impl:: ParameterNode ) .getParameter ( ) )
100+ exists ( SsaImpl:: ParameterExt p |
101+ n = toParameterNode ( p ) and
102+ p .isInitializedBy ( result .( Impl:: WriteDefSourceNode ) .getDefinition ( ) )
103+ )
104+ or
105+ result .( Impl:: WriteDefSourceNode ) .getDefinition ( ) .( Ssa:: WriteDefinition ) .assigns ( n .asExpr ( ) )
101106 }
102107
103- predicate localFlowStep ( SsaImpl:: DefinitionExt def , Node nodeFrom , Node nodeTo , boolean isUseStep ) {
104- Impl:: localFlowStep ( def , asNode ( nodeFrom ) , asNode ( nodeTo ) , isUseStep )
108+ predicate localFlowStep (
109+ SsaImpl:: SsaInput:: SourceVariable v , Node nodeFrom , Node nodeTo , boolean isUseStep
110+ ) {
111+ Impl:: localFlowStep ( v , asNode ( nodeFrom ) , asNode ( nodeTo ) , isUseStep )
105112 }
106113
107- predicate localMustFlowStep ( SsaImpl :: DefinitionExt def , Node nodeFrom , Node nodeTo ) {
108- Impl:: localMustFlowStep ( def , asNode ( nodeFrom ) , asNode ( nodeTo ) )
114+ predicate localMustFlowStep ( Node nodeFrom , Node nodeTo ) {
115+ Impl:: localMustFlowStep ( _ , asNode ( nodeFrom ) , asNode ( nodeTo ) )
109116 }
110117}
111118
@@ -179,7 +186,7 @@ module LocalFlow {
179186 }
180187
181188 predicate localMustFlowStep ( Node nodeFrom , Node nodeTo ) {
182- SsaFlow:: localMustFlowStep ( _ , nodeFrom , nodeTo )
189+ SsaFlow:: localMustFlowStep ( nodeFrom , nodeTo )
183190 or
184191 nodeFrom =
185192 unique( FlowSummaryNode n1 |
@@ -258,9 +265,7 @@ private module Cached {
258265 (
259266 LocalFlow:: localFlowStepCommon ( nodeFrom , nodeTo )
260267 or
261- exists ( SsaImpl:: DefinitionExt def , boolean isUseStep |
262- SsaFlow:: localFlowStep ( def , nodeFrom , nodeTo , isUseStep )
263- |
268+ exists ( boolean isUseStep | SsaFlow:: localFlowStep ( _, nodeFrom , nodeTo , isUseStep ) |
264269 isUseStep = false
265270 or
266271 isUseStep = true and
@@ -293,8 +298,8 @@ private module Cached {
293298 }
294299
295300 /** Holds if `n` wraps an SSA definition without ingoing flow. */
296- private predicate entrySsaDefinition ( SsaDefinitionExtNode n ) {
297- n .getDefinitionExt ( ) =
301+ private predicate entrySsaDefinition ( SsaDefinitionNodeImpl n ) {
302+ n .getDefinition ( ) =
298303 any ( SsaImpl:: WriteDefinition def | not def .( Ssa:: WriteDefinition ) .assigns ( _) )
299304 }
300305
@@ -334,7 +339,7 @@ private module Cached {
334339 // to parameters (which are themselves local sources)
335340 entrySsaDefinition ( n ) and
336341 not exists ( SsaImpl:: ParameterExt p |
337- p .isInitializedBy ( n .( SsaDefinitionExtNode ) . getDefinitionExt ( ) )
342+ p .isInitializedBy ( n .( SsaDefinitionNodeImpl ) . getDefinition ( ) )
338343 )
339344 or
340345 isStoreTargetNode ( n )
@@ -419,57 +424,36 @@ predicate nodeIsHidden(Node n) { n.(NodeImpl).nodeIsHidden() }
419424predicate neverSkipInPathGraph ( Node n ) { isReturned ( n .( AstNode ) .getCfgNode ( ) ) }
420425
421426/** An SSA node. */
422- abstract class SsaNode extends NodeImpl , TSsaNode {
427+ class SsaNode extends NodeImpl , TSsaNode {
423428 SsaImpl:: DataFlowIntegration:: SsaNode node ;
424- SsaImpl:: DefinitionExt def ;
425429
426- SsaNode ( ) {
427- this = TSsaNode ( node ) and
428- def = node .getDefinitionExt ( )
429- }
430+ SsaNode ( ) { this = TSsaNode ( node ) }
430431
431- SsaImpl:: DefinitionExt getDefinitionExt ( ) { result = def }
432+ /** Gets the underlying variable. */
433+ Variable getVariable ( ) { result = node .getSourceVariable ( ) }
432434
433435 /** Holds if this node should be hidden from path explanations. */
434- abstract predicate isHidden ( ) ;
436+ predicate isHidden ( ) { any ( ) }
437+
438+ override CfgScope getCfgScope ( ) { result = node .getBasicBlock ( ) .getScope ( ) }
435439
436440 override Location getLocationImpl ( ) { result = node .getLocation ( ) }
437441
438442 override string toStringImpl ( ) { result = node .toString ( ) }
439443}
440444
441- /** An (extended) SSA definition, viewed as a node in a data flow graph. */
442- class SsaDefinitionExtNode extends SsaNode {
443- override SsaImpl:: DataFlowIntegration:: SsaDefinitionExtNode node ;
445+ class SsaDefinitionNodeImpl extends SsaNode {
446+ override SsaImpl:: DataFlowIntegration:: SsaDefinitionNode node ;
444447
445- /** Gets the underlying variable. */
446- Variable getVariable ( ) { result = def .getSourceVariable ( ) }
448+ Ssa:: Definition getDefinition ( ) { result = node .getDefinition ( ) }
447449
448450 override predicate isHidden ( ) {
449- not def instanceof Ssa:: WriteDefinition
450- or
451- def = getParameterDef ( _)
451+ exists ( SsaImpl:: Definition def | def = this .getDefinition ( ) |
452+ not def instanceof Ssa:: WriteDefinition
453+ or
454+ def = getParameterDef ( _)
455+ )
452456 }
453-
454- override CfgScope getCfgScope ( ) { result = def .getBasicBlock ( ) .getScope ( ) }
455- }
456-
457- class SsaDefinitionNodeImpl extends SsaDefinitionExtNode {
458- Ssa:: Definition ssaDef ;
459-
460- SsaDefinitionNodeImpl ( ) { ssaDef = def }
461-
462- override Location getLocationImpl ( ) { result = ssaDef .getLocation ( ) }
463-
464- override string toStringImpl ( ) { result = ssaDef .toString ( ) }
465- }
466-
467- class SsaInputNode extends SsaNode {
468- override SsaImpl:: DataFlowIntegration:: SsaInputNode node ;
469-
470- override predicate isHidden ( ) { any ( ) }
471-
472- override CfgScope getCfgScope ( ) { result = node .getDefinitionExt ( ) .getBasicBlock ( ) .getScope ( ) }
473457}
474458
475459private string getANamedArgument ( CfgNodes:: ExprNodes:: CallExprCfgNode c ) {
0 commit comments