Skip to content

Commit 5927bb2

Browse files
committed
Dataflow: Replace "extends Node" with "instanceof Node".
1 parent 383b2e1 commit 5927bb2

File tree

8 files changed

+120
-40
lines changed

8 files changed

+120
-40
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

go/ql/lib/semmle/go/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,10 @@ predicate recordDataFlowCallSite(DataFlowCall call, DataFlowCallable callable) {
961961
/**
962962
* A `Node` at which a cast can occur such that the type should be checked.
963963
*/
964-
class CastingNode extends Node {
964+
class CastingNode instanceof Node {
965965
CastingNode() { castingNode(this) }
966+
967+
string toString() { result = super.toString() }
966968
}
967969

968970
private predicate readStepWithTypes(
@@ -1110,9 +1112,11 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
11101112
* The value of a parameter at function entry, viewed as a node in a data
11111113
* flow graph.
11121114
*/
1113-
class ParamNode extends Node {
1115+
class ParamNode instanceof Node {
11141116
ParamNode() { parameterNode(this, _, _) }
11151117

1118+
string toString() { result = super.toString() }
1119+
11161120
/**
11171121
* Holds if this node is the parameter of callable `c` at the specified
11181122
* position.
@@ -1121,9 +1125,11 @@ class ParamNode extends Node {
11211125
}
11221126

11231127
/** A data-flow node that represents a call argument. */
1124-
class ArgNode extends Node {
1128+
class ArgNode instanceof Node {
11251129
ArgNode() { argumentNode(this, _, _) }
11261130

1131+
string toString() { result = super.toString() }
1132+
11271133
/** Holds if this argument occurs at the given position in the given call. */
11281134
final predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
11291135
argumentNode(this, call, pos)
@@ -1134,9 +1140,11 @@ class ArgNode extends Node {
11341140
* A node from which flow can return to the caller. This is either a regular
11351141
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
11361142
*/
1137-
class ReturnNodeExt extends Node {
1143+
class ReturnNodeExt instanceof Node {
11381144
ReturnNodeExt() { returnNodeExt(this, _) }
11391145

1146+
string toString() { result = super.toString() }
1147+
11401148
/** Gets the kind of this returned value. */
11411149
ReturnKindExt getKind() { returnNodeExt(this, result) }
11421150
}
@@ -1145,8 +1153,10 @@ class ReturnNodeExt extends Node {
11451153
* A node to which data can flow from a call. Either an ordinary out node
11461154
* or a post-update node associated with a call argument.
11471155
*/
1148-
class OutNodeExt extends Node {
1156+
class OutNodeExt instanceof Node {
11491157
OutNodeExt() { outNodeExt(this) }
1158+
1159+
string toString() { result = super.toString() }
11501160
}
11511161

11521162
/**

0 commit comments

Comments
 (0)