@@ -664,7 +664,7 @@ module LocalFlow {
664
664
ssaDef .getADefinition ( ) = def and
665
665
ssaDef .getControlFlowNode ( ) = cfn and
666
666
nodeFrom = TAssignableDefinitionNode ( def , cfn ) and
667
- nodeTo .( SsaDefinitionExtNode ) . getDefinitionExt ( ) = ssaDef
667
+ nodeTo .( SsaDefinitionNode ) . getDefinition ( ) = ssaDef
668
668
)
669
669
}
670
670
@@ -1269,78 +1269,33 @@ predicate nodeIsHidden(Node n) {
1269
1269
}
1270
1270
1271
1271
/** An SSA node. */
1272
- abstract class SsaNode extends NodeImpl , TSsaNode {
1272
+ class SsaNode extends NodeImpl , TSsaNode {
1273
1273
SsaImpl:: DataFlowIntegration:: SsaNode node ;
1274
- SsaImpl:: DefinitionExt def ;
1275
1274
1276
- SsaNode ( ) {
1277
- this = TSsaNode ( node ) and
1278
- def = node .getDefinitionExt ( )
1279
- }
1280
-
1281
- SsaImpl:: DefinitionExt getDefinitionExt ( ) { result = def }
1275
+ SsaNode ( ) { this = TSsaNode ( node ) }
1282
1276
1283
1277
override DataFlowCallable getEnclosingCallableImpl ( ) {
1284
- result .getAControlFlowNode ( ) .getBasicBlock ( ) = def .getBasicBlock ( )
1278
+ result .getAControlFlowNode ( ) .getBasicBlock ( ) = node .getBasicBlock ( )
1285
1279
}
1286
1280
1287
- override Type getTypeImpl ( ) { result = def .getSourceVariable ( ) .getType ( ) }
1281
+ override Type getTypeImpl ( ) { result = node .getSourceVariable ( ) .getType ( ) }
1288
1282
1289
- override ControlFlow:: Node getControlFlowNodeImpl ( ) {
1290
- result = def .( Ssa:: Definition ) .getControlFlowNode ( )
1291
- }
1283
+ override ControlFlow:: Node getControlFlowNodeImpl ( ) { none ( ) }
1292
1284
1293
1285
override Location getLocationImpl ( ) { result = node .getLocation ( ) }
1294
1286
1295
1287
override string toStringImpl ( ) { result = node .toString ( ) }
1296
1288
}
1297
1289
1298
- /** An (extended) SSA definition, viewed as a node in a data flow graph. */
1299
- class SsaDefinitionExtNode extends SsaNode {
1300
- override SsaImpl:: DataFlowIntegration:: SsaDefinitionExtNode node ;
1301
- }
1290
+ /** An SSA definition, viewed as a node in a data flow graph. */
1291
+ class SsaDefinitionNode extends SsaNode {
1292
+ override SsaImpl:: DataFlowIntegration:: SsaDefinitionNode node ;
1302
1293
1303
- /**
1304
- * A node that represents an input to an SSA phi (read) definition.
1305
- *
1306
- * This allows for barrier guards to filter input to phi nodes. For example, in
1307
- *
1308
- * ```csharp
1309
- * var x = taint;
1310
- * if (x != "safe")
1311
- * {
1312
- * x = "safe";
1313
- * }
1314
- * sink(x);
1315
- * ```
1316
- *
1317
- * the `false` edge out of `x != "safe"` guards the input from `x = taint` into the
1318
- * `phi` node after the condition.
1319
- *
1320
- * It is also relevant to filter input into phi read nodes:
1321
- *
1322
- * ```csharp
1323
- * var x = taint;
1324
- * if (b)
1325
- * {
1326
- * if (x != "safe1")
1327
- * {
1328
- * return;
1329
- * }
1330
- * } else {
1331
- * if (x != "safe2")
1332
- * {
1333
- * return;
1334
- * }
1335
- * }
1336
- *
1337
- * sink(x);
1338
- * ```
1339
- *
1340
- * both inputs into the phi read node after the outer condition are guarded.
1341
- */
1342
- class SsaInputNode extends SsaNode {
1343
- override SsaImpl:: DataFlowIntegration:: SsaInputNode node ;
1294
+ Ssa:: Definition getDefinition ( ) { result = node .getDefinition ( ) }
1295
+
1296
+ override ControlFlow:: Node getControlFlowNodeImpl ( ) {
1297
+ result = this .getDefinition ( ) .getControlFlowNode ( )
1298
+ }
1344
1299
}
1345
1300
1346
1301
/** A definition, viewed as a node in a data flow graph. */
@@ -1728,12 +1683,12 @@ private module ReturnNodes {
1728
1683
* A data-flow node that represents an assignment to an `out` or a `ref`
1729
1684
* parameter.
1730
1685
*/
1731
- class OutRefReturnNode extends ReturnNode , SsaDefinitionExtNode {
1686
+ class OutRefReturnNode extends ReturnNode , SsaDefinitionNode {
1732
1687
OutRefReturnKind kind ;
1733
1688
1734
1689
OutRefReturnNode ( ) {
1735
1690
exists ( Parameter p |
1736
- this .getDefinitionExt ( ) . ( Ssa :: Definition ) .isLiveOutRefParameterDefinition ( p ) and
1691
+ this .getDefinition ( ) .isLiveOutRefParameterDefinition ( p ) and
1737
1692
kind .getPosition ( ) = p .getPosition ( )
1738
1693
|
1739
1694
p .isOut ( ) and kind instanceof OutReturnKind
@@ -2464,7 +2419,7 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
2464
2419
exists ( ForeachStmt fs , Ssa:: ExplicitDefinition def |
2465
2420
x .hasDefPath ( fs .getIterableExpr ( ) , node1 .getControlFlowNode ( ) , def .getADefinition ( ) ,
2466
2421
def .getControlFlowNode ( ) ) and
2467
- node2 .( SsaDefinitionExtNode ) . getDefinitionExt ( ) = def and
2422
+ node2 .( SsaDefinitionNode ) . getDefinition ( ) = def and
2468
2423
c instanceof ElementContent
2469
2424
)
2470
2425
or
0 commit comments