Skip to content

Commit fd3615d

Browse files
committed
C++: Show that there are too many partial defs
1 parent 2806a52 commit fd3615d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cpp/ql/test/library-tests/dataflow/partialdefinitions/partialdefinitions.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ void test()
1414
s.x = 1;
1515
s.y.z = 1;
1616
}
17+
18+
struct Int {
19+
int data;
20+
Int(int value) : data(value) { } // Not a partial definition but a `PostUpdateNode`
21+
int getData() const { return data; }
22+
void setData(int value) { data = value; }
23+
};
24+
25+
int getSet() {
26+
Int myInt(1);
27+
myInt.setData(
28+
myInt.getData() + 1 // should not be a partial def
29+
);
30+
return myInt.getData(); // should not be a partial def
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
| partialdefinitions.cpp:14:2:14:2 | partial def of s | partialdefinitions.cpp:14:2:14:2 | s | partialdefinitions.cpp:14:2:14:8 | ... = ... |
22
| partialdefinitions.cpp:15:2:15:2 | partial def of s | partialdefinitions.cpp:15:2:15:2 | s | partialdefinitions.cpp:15:2:15:10 | ... = ... |
33
| partialdefinitions.cpp:15:4:15:4 | partial def of y | partialdefinitions.cpp:15:4:15:4 | y | partialdefinitions.cpp:15:2:15:10 | ... = ... |
4+
| partialdefinitions.cpp:22:29:22:32 | partial def of this | file://:0:0:0:0 | this | partialdefinitions.cpp:22:29:22:40 | ... = ... |
5+
| partialdefinitions.cpp:27:3:27:7 | partial def of myInt | partialdefinitions.cpp:27:3:27:7 | myInt | partialdefinitions.cpp:27:3:27:7 | myInt |
6+
| partialdefinitions.cpp:28:7:28:11 | partial def of myInt | partialdefinitions.cpp:28:7:28:11 | myInt | partialdefinitions.cpp:28:7:28:11 | myInt |
7+
| partialdefinitions.cpp:30:10:30:14 | partial def of myInt | partialdefinitions.cpp:30:10:30:14 | myInt | partialdefinitions.cpp:30:10:30:14 | myInt |

0 commit comments

Comments
 (0)