mirror of
https://github.com/github/codeql.git
synced 2025-12-23 20:26:32 +01:00
C++: Fix a number of instances where a dataflow node did not have a location
This commit is contained in:
@@ -405,7 +405,11 @@ class InstructionNode extends Node0 {
|
|||||||
/** Gets the instruction corresponding to this node. */
|
/** Gets the instruction corresponding to this node. */
|
||||||
Instruction getInstruction() { result = instr }
|
Instruction getInstruction() { result = instr }
|
||||||
|
|
||||||
override Location getLocationImpl() { result = instr.getAst().getLocation() }
|
override Location getLocationImpl() {
|
||||||
|
if exists(instr.getAst().getLocation())
|
||||||
|
then result = instr.getAst().getLocation()
|
||||||
|
else result instanceof UnknownDefaultLocation
|
||||||
|
}
|
||||||
|
|
||||||
override string toStringImpl() {
|
override string toStringImpl() {
|
||||||
if instr.(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
|
if instr.(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
|
||||||
@@ -426,7 +430,11 @@ class OperandNode extends Node, Node0 {
|
|||||||
/** Gets the operand corresponding to this node. */
|
/** Gets the operand corresponding to this node. */
|
||||||
Operand getOperand() { result = op }
|
Operand getOperand() { result = op }
|
||||||
|
|
||||||
override Location getLocationImpl() { result = op.getDef().getAst().getLocation() }
|
override Location getLocationImpl() {
|
||||||
|
if exists(op.getDef().getAst().getLocation())
|
||||||
|
then result = op.getDef().getAst().getLocation()
|
||||||
|
else result instanceof UnknownDefaultLocation
|
||||||
|
}
|
||||||
|
|
||||||
override string toStringImpl() {
|
override string toStringImpl() {
|
||||||
if op.getDef().(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
|
if op.getDef().(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
|
||||||
@@ -641,6 +649,8 @@ class IndirectParameterNode extends Node, IndirectInstruction {
|
|||||||
|
|
||||||
override Declaration getFunction() { result = this.getInstruction().getEnclosingFunction() }
|
override Declaration getFunction() { result = this.getInstruction().getEnclosingFunction() }
|
||||||
|
|
||||||
|
override Location getLocationImpl() { result = this.getParameter().getLocation() }
|
||||||
|
|
||||||
override string toStringImpl() {
|
override string toStringImpl() {
|
||||||
result = this.getParameter().toString() + " indirection"
|
result = this.getParameter().toString() + " indirection"
|
||||||
or
|
or
|
||||||
@@ -888,7 +898,11 @@ class RawIndirectOperand extends Node, TRawIndirectOperand {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override Location getLocationImpl() { result = this.getOperand().getLocation() }
|
final override Location getLocationImpl() {
|
||||||
|
if exists(this.getOperand().getLocation())
|
||||||
|
then result = this.getOperand().getLocation()
|
||||||
|
else result instanceof UnknownDefaultLocation
|
||||||
|
}
|
||||||
|
|
||||||
override string toStringImpl() {
|
override string toStringImpl() {
|
||||||
result = instructionNode(this.getOperand().getDef()).toStringImpl() + " indirection"
|
result = instructionNode(this.getOperand().getDef()).toStringImpl() + " indirection"
|
||||||
@@ -987,7 +1001,11 @@ class RawIndirectInstruction extends Node, TRawIndirectInstruction {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override Location getLocationImpl() { result = this.getInstruction().getLocation() }
|
final override Location getLocationImpl() {
|
||||||
|
if exists(this.getInstruction().getLocation())
|
||||||
|
then result = this.getInstruction().getLocation()
|
||||||
|
else result instanceof UnknownDefaultLocation
|
||||||
|
}
|
||||||
|
|
||||||
override string toStringImpl() {
|
override string toStringImpl() {
|
||||||
result = instructionNode(this.getInstruction()).toStringImpl() + " indirection"
|
result = instructionNode(this.getInstruction()).toStringImpl() + " indirection"
|
||||||
|
|||||||
@@ -1,20 +1,7 @@
|
|||||||
uniqueEnclosingCallable
|
uniqueEnclosingCallable
|
||||||
uniqueType
|
uniqueType
|
||||||
uniqueNodeLocation
|
uniqueNodeLocation
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
| file://:0:0:0:0 | (unnamed parameter 2) indirection | Node should have one location but has 0. |
|
|
||||||
missingLocation
|
missingLocation
|
||||||
| Nodes without location: 12 |
|
|
||||||
uniqueNodeToString
|
uniqueNodeToString
|
||||||
missingToString
|
missingToString
|
||||||
parameterCallable
|
parameterCallable
|
||||||
|
|||||||
Reference in New Issue
Block a user