C++: Remove unnecessary recursion through Node.toString.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-02-26 15:06:07 +00:00
parent 17e6fd2fe9
commit 85875c2879
2 changed files with 7 additions and 7 deletions

View File

@@ -201,7 +201,7 @@ module SourceSinkInterpretationInput implements
string toString() {
result = this.asElement().toString()
or
result = this.asNode().toString()
result = this.asNode().toStringImpl()
or
result = this.asCall().toString()
}

View File

@@ -968,7 +968,7 @@ private class Node0 extends Node, TNode0 {
override Location getLocationImpl() { result = node.getLocation() }
override string toStringImpl() { result = node.toString() }
override string toStringImpl() { result = node.toStringImpl() }
override Type getType() { result = node.getType() }
@@ -1020,7 +1020,9 @@ class PostFieldUpdateNode extends PostUpdateNodeImpl {
Field getUpdatedField() { result = this.getFieldAddress().getField() }
override string toStringImpl() { result = this.getPreUpdateNode() + " [post update]" }
override string toStringImpl() {
result = this.getPreUpdateNode().toStringImpl() + " [post update]"
}
}
/**
@@ -1187,9 +1189,7 @@ private class RawIndirectOperand0 extends Node, TRawIndirectOperand0 {
else result instanceof UnknownLocation
}
override string toStringImpl() {
result = stars(this) + operandNode(this.getOperand()).toStringImpl()
}
override string toStringImpl() { result = stars(this) + operandToString(this.getOperand()) }
}
/**
@@ -1232,7 +1232,7 @@ private class RawIndirectInstruction0 extends Node, TRawIndirectInstruction0 {
}
override string toStringImpl() {
result = stars(this) + instructionNode(this.getInstruction()).toStringImpl()
result = stars(this) + instructionToString(this.getInstruction())
}
}