Skip to content

Commit 85875c2

Browse files
committed
C++: Remove unnecessary recursion through Node.toString.
1 parent 17e6fd2 commit 85875c2

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
@@ -968,7 +968,7 @@ private class Node0 extends Node, TNode0 {
968968

969969
override Location getLocationImpl() { result = node.getLocation() }
970970

971-
override string toStringImpl() { result = node.toString() }
971+
override string toStringImpl() { result = node.toStringImpl() }
972972

973973
override Type getType() { result = node.getType() }
974974

@@ -1020,7 +1020,9 @@ class PostFieldUpdateNode extends PostUpdateNodeImpl {
10201020

10211021
Field getUpdatedField() { result = this.getFieldAddress().getField() }
10221022

1023-
override string toStringImpl() { result = this.getPreUpdateNode() + " [post update]" }
1023+
override string toStringImpl() {
1024+
result = this.getPreUpdateNode().toStringImpl() + " [post update]"
1025+
}
10241026
}
10251027

10261028
/**
@@ -1187,9 +1189,7 @@ private class RawIndirectOperand0 extends Node, TRawIndirectOperand0 {
11871189
else result instanceof UnknownLocation
11881190
}
11891191

1190-
override string toStringImpl() {
1191-
result = stars(this) + operandNode(this.getOperand()).toStringImpl()
1192-
}
1192+
override string toStringImpl() { result = stars(this) + operandToString(this.getOperand()) }
11931193
}
11941194

11951195
/**
@@ -1232,7 +1232,7 @@ private class RawIndirectInstruction0 extends Node, TRawIndirectInstruction0 {
12321232
}
12331233

12341234
override string toStringImpl() {
1235-
result = stars(this) + instructionNode(this.getInstruction()).toStringImpl()
1235+
result = stars(this) + instructionToString(this.getInstruction())
12361236
}
12371237
}
12381238

0 commit comments

Comments
 (0)