@@ -97,15 +97,22 @@ module SsaFlow {
97
97
or
98
98
result .( Impl:: ExprPostUpdateNode ) .getExpr ( ) = n .( PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( )
99
99
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 ( ) )
101
106
}
102
107
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 )
105
112
}
106
113
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 ) )
109
116
}
110
117
}
111
118
@@ -179,7 +186,7 @@ module LocalFlow {
179
186
}
180
187
181
188
predicate localMustFlowStep ( Node nodeFrom , Node nodeTo ) {
182
- SsaFlow:: localMustFlowStep ( _ , nodeFrom , nodeTo )
189
+ SsaFlow:: localMustFlowStep ( nodeFrom , nodeTo )
183
190
or
184
191
nodeFrom =
185
192
unique( FlowSummaryNode n1 |
@@ -258,9 +265,7 @@ private module Cached {
258
265
(
259
266
LocalFlow:: localFlowStepCommon ( nodeFrom , nodeTo )
260
267
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 ) |
264
269
isUseStep = false
265
270
or
266
271
isUseStep = true and
@@ -293,8 +298,8 @@ private module Cached {
293
298
}
294
299
295
300
/** 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 ( ) =
298
303
any ( SsaImpl:: WriteDefinition def | not def .( Ssa:: WriteDefinition ) .assigns ( _) )
299
304
}
300
305
@@ -334,7 +339,7 @@ private module Cached {
334
339
// to parameters (which are themselves local sources)
335
340
entrySsaDefinition ( n ) and
336
341
not exists ( SsaImpl:: ParameterExt p |
337
- p .isInitializedBy ( n .( SsaDefinitionExtNode ) . getDefinitionExt ( ) )
342
+ p .isInitializedBy ( n .( SsaDefinitionNodeImpl ) . getDefinition ( ) )
338
343
)
339
344
or
340
345
isStoreTargetNode ( n )
@@ -419,57 +424,36 @@ predicate nodeIsHidden(Node n) { n.(NodeImpl).nodeIsHidden() }
419
424
predicate neverSkipInPathGraph ( Node n ) { isReturned ( n .( AstNode ) .getCfgNode ( ) ) }
420
425
421
426
/** An SSA node. */
422
- abstract class SsaNode extends NodeImpl , TSsaNode {
427
+ class SsaNode extends NodeImpl , TSsaNode {
423
428
SsaImpl:: DataFlowIntegration:: SsaNode node ;
424
- SsaImpl:: DefinitionExt def ;
425
429
426
- SsaNode ( ) {
427
- this = TSsaNode ( node ) and
428
- def = node .getDefinitionExt ( )
429
- }
430
+ SsaNode ( ) { this = TSsaNode ( node ) }
430
431
431
- SsaImpl:: DefinitionExt getDefinitionExt ( ) { result = def }
432
+ /** Gets the underlying variable. */
433
+ Variable getVariable ( ) { result = node .getSourceVariable ( ) }
432
434
433
435
/** 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 ( ) }
435
439
436
440
override Location getLocationImpl ( ) { result = node .getLocation ( ) }
437
441
438
442
override string toStringImpl ( ) { result = node .toString ( ) }
439
443
}
440
444
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 ;
444
447
445
- /** Gets the underlying variable. */
446
- Variable getVariable ( ) { result = def .getSourceVariable ( ) }
448
+ Ssa:: Definition getDefinition ( ) { result = node .getDefinition ( ) }
447
449
448
450
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
+ )
452
456
}
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 ( ) }
473
457
}
474
458
475
459
private string getANamedArgument ( CfgNodes:: ExprNodes:: CallExprCfgNode c ) {
0 commit comments