C++: Fix multiple getLocation consistency error in use-use dataflow

This commit is contained in:
Jeroen Ketema
2023-03-09 10:25:02 +01:00
parent 55da3257bf
commit 791f5913d2
2 changed files with 5 additions and 13 deletions

View File

@@ -390,7 +390,7 @@ private class Node0 extends Node, TNode0 {
override DataFlowType getType() { result = node.getType() } override DataFlowType getType() { result = node.getType() }
final override Location getLocationImpl() { result = node.getLocationImpl() } override Location getLocationImpl() { result = node.getLocationImpl() }
override string toStringImpl() { override string toStringImpl() {
// This predicate is overridden in subclasses. This default implementation // This predicate is overridden in subclasses. This default implementation
@@ -413,6 +413,8 @@ 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 string toStringImpl() { override string toStringImpl() {
if instr.(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable if instr.(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
then result = "this" then result = "this"
@@ -432,6 +434,8 @@ 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 string toStringImpl() { override string toStringImpl() {
if op.getDef().(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable if op.getDef().(InitializeParameterInstruction).getIRVariable() instanceof IRThisVariable
then result = "this" then result = "this"

View File

@@ -1,12 +1,6 @@
uniqueEnclosingCallable uniqueEnclosingCallable
uniqueType uniqueType
uniqueNodeLocation uniqueNodeLocation
| cpp11.cpp:28:21:28:21 | (__range) | Node should have one location but has 2. |
| cpp11.cpp:28:21:28:21 | (__range) | Node should have one location but has 2. |
| file://:0:0:0:0 | (__range) | Node should have one location but has 2. |
| file://:0:0:0:0 | (__range) | Node should have one location but has 2. |
| file://:0:0:0:0 | (__range) | Node should have one location but has 2. |
| file://:0:0:0:0 | (__range) | Node should have one location but has 2. |
| 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) | Node should have one location but has 0. |
@@ -19,12 +13,6 @@ uniqueNodeLocation
| 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 | this | Node should have one location but has 2. |
| file://:0:0:0:0 | this | Node should have one location but has 2. |
| ir.cpp:756:8:756:8 | this | Node should have one location but has 2. |
| ir.cpp:765:8:765:8 | this | Node should have one location but has 2. |
| stream_it.cpp:11:16:11:16 | (__range) | Node should have one location but has 2. |
| stream_it.cpp:11:16:11:16 | (__range) | Node should have one location but has 2. |
missingLocation missingLocation
| Nodes without location: 12 | | Nodes without location: 12 |
uniqueNodeToString uniqueNodeToString