Skip to content

Commit 1d06afa

Browse files
committed
C++: Remove unnecessary recursion through Node.toString.
1 parent 5cb77f2 commit 1d06afa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module SourceSinkInterpretationInput implements
201201
string toString() {
202202
result = this.asElement().toString()
203203
or
204-
result = this.asNode().toString()
204+
result = this.asNode().toStringImpl()
205205
or
206206
result = this.asCall().toString()
207207
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ private class Node0 extends Node, TNode0 {
975975

976976
override Location getLocationImpl() { result = node.getLocation() }
977977

978-
override string toStringImpl() { result = node.toString() }
978+
override string toStringImpl() { result = node.toStringImpl() }
979979

980980
override Type getType() { result = node.getType() }
981981

@@ -1027,7 +1027,9 @@ class PostFieldUpdateNode extends PostUpdateNodeImpl {
10271027

10281028
Field getUpdatedField() { result = this.getFieldAddress().getField() }
10291029

1030-
override string toStringImpl() { result = this.getPreUpdateNode() + " [post update]" }
1030+
override string toStringImpl() {
1031+
result = this.getPreUpdateNode().toStringImpl() + " [post update]"
1032+
}
10311033
}
10321034

10331035
/**
@@ -1195,9 +1197,7 @@ private module RawIndirectNodes {
11951197
else result instanceof UnknownLocation
11961198
}
11971199

1198-
override string toStringImpl() {
1199-
result = stars(this) + operandNode(this.getOperand()).toStringImpl()
1200-
}
1200+
override string toStringImpl() { result = stars(this) + operandToString(this.getOperand()) }
12011201
}
12021202

12031203
/**
@@ -1240,7 +1240,7 @@ private module RawIndirectNodes {
12401240
}
12411241

12421242
override string toStringImpl() {
1243-
result = stars(this) + instructionNode(this.getInstruction()).toStringImpl()
1243+
result = stars(this) + instructionToString(this.getInstruction())
12441244
}
12451245
}
12461246

0 commit comments

Comments
 (0)