mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
CPP: Create a direct test of Variable.getAnAssignedValue().
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
| test.cpp:4:9:4:11 | 10 | test.cpp:4:6:4:6 | v |
|
||||
| test.cpp:5:15:5:16 | & ... | test.cpp:5:7:5:11 | ptr_v |
|
||||
| test.cpp:6:15:6:15 | v | test.cpp:6:7:6:11 | ref_v |
|
||||
| test.cpp:8:6:8:7 | 11 | test.cpp:4:6:4:6 | v |
|
||||
| test.cpp:10:10:10:11 | 13 | test.cpp:6:7:6:11 | ref_v |
|
||||
| test.cpp:11:6:11:10 | ... + ... | test.cpp:4:6:4:6 | v |
|
||||
| test.cpp:19:32:19:35 | 0.0 | test.cpp:19:27:19:28 | _y |
|
||||
| test.cpp:19:42:19:43 | _x | test.cpp:24:8:24:8 | x |
|
||||
| test.cpp:19:49:19:50 | _y | test.cpp:24:11:24:11 | y |
|
||||
| test.cpp:19:54:19:60 | 0.0 | test.cpp:24:14:24:14 | z |
|
||||
@@ -0,0 +1,4 @@
|
||||
import cpp
|
||||
|
||||
from Variable v
|
||||
select v.getAnAssignedValue(), v
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
void test1()
|
||||
{
|
||||
int v = 10; // assignment to `v`
|
||||
int *ptr_v = &v; // assignment to `ptr_v`
|
||||
int &ref_v = v; // assignment to `ref_v`
|
||||
|
||||
v = 11; // assignment to `v`
|
||||
*ptr_v = 12;
|
||||
ref_v = 13; // assignment to `ref_v`
|
||||
v = v + 1; // assignment to `v`
|
||||
v += 1;
|
||||
v++;
|
||||
}
|
||||
|
||||
class myClass1
|
||||
{
|
||||
public:
|
||||
myClass1(float _x, float _y = 0.0f) : x(_x), y(_y), z(0.0f) { // assignments to `_y`, `x`, `y`, `z`
|
||||
// ...
|
||||
}
|
||||
|
||||
private:
|
||||
float x, y, z;
|
||||
};
|
||||
Reference in New Issue
Block a user