C++: PartialDefNode -> PartialDefinitionNode

This commit is contained in:
Jonas Jensen
2019-08-08 10:44:27 +02:00
parent 98d6f3cada
commit 0a13d7a337

View File

@@ -9,7 +9,7 @@ private import semmle.code.cpp.models.interfaces.DataFlow
cached cached
private newtype TNode = private newtype TNode =
TExprNode(Expr e) or TExprNode(Expr e) or
TPartialDefNode(PartialDefinition pd) or TPartialDefinitionNode(PartialDefinition pd) or
TPostConstructorCallNode(ConstructorCall call) or TPostConstructorCallNode(ConstructorCall call) or
TExplicitParameterNode(Parameter p) { exists(p.getFunction().getBlock()) } or TExplicitParameterNode(Parameter p) { exists(p.getFunction().getBlock()) } or
TInstanceParameterNode(MemberFunction f) { exists(f.getBlock()) and not f.isStatic() } or TInstanceParameterNode(MemberFunction f) { exists(f.getBlock()) and not f.isStatic() } or
@@ -52,7 +52,7 @@ class Node extends TNode {
* a partial definition of `&x`).s * a partial definition of `&x`).s
*/ */
Expr asPartialDefinition() { Expr asPartialDefinition() {
result = this.(PartialDefNode).getPartialDefinition().getDefinedExpr() result = this.(PartialDefinitionNode).getPartialDefinition().getDefinedExpr()
} }
/** /**
@@ -149,7 +149,7 @@ class ImplicitParameterNode extends ParameterNode, TInstanceParameterNode {
* `DefinitionByReferenceNode` to represent the value of `x` after the call has * `DefinitionByReferenceNode` to represent the value of `x` after the call has
* returned. This node will have its `getArgument()` equal to `&x`. * returned. This node will have its `getArgument()` equal to `&x`.
*/ */
class DefinitionByReferenceNode extends PartialDefNode { class DefinitionByReferenceNode extends PartialDefinitionNode {
VariableAccess va; VariableAccess va;
Expr argument; Expr argument;
@@ -230,10 +230,10 @@ abstract class PostUpdateNode extends Node {
override string toString() { result = getPreUpdateNode().toString() + " [post update]" } override string toString() { result = getPreUpdateNode().toString() + " [post update]" }
} }
class PartialDefNode extends PostUpdateNode, TPartialDefNode { class PartialDefinitionNode extends PostUpdateNode, TPartialDefinitionNode {
PartialDefinition pd; PartialDefinition pd;
PartialDefNode() { this = TPartialDefNode(pd) } PartialDefinitionNode() { this = TPartialDefinitionNode(pd) }
override Node getPreUpdateNode() { result.asExpr() = pd.getDefinedExpr() } override Node getPreUpdateNode() { result.asExpr() = pd.getDefinedExpr() }