mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
Depending on the extraction order, before this change there might be multiple
`GlobalVariable`s per declared global variable. See the tests in
`cpp/ql/test/library-tests/variables/global`. This change ensures that only one
of those `GlobalVariable`s is visible to the user if we can locate a unique
definition. If not, the old situation persists.
Note that an exception needs to be made for templated variables. Here, the
definition refers to the non-instantiated template, while a declaration that
is not a definition refers to an instantiation. In case the instantiation refers
to a template parameter, the mangled names of the template and the instantiation
will be identical. This happens for example in the following case:
```
template <typename T>
T x = T(42); // Uninstantiated templated variable
template <typename T>
class C {
T y = x<T>; // Instantiation using a template parameter
};
```
Since the uninstantiated template and the instantiation are two different
entities, we do not unify them as described above.
14 lines
746 B
Plaintext
14 lines
746 B
Plaintext
| a.c:4:5:4:6 | is | array of {int} | 1 |
|
|
| c.c:2:5:2:6 | js | array of {int} | 1 |
|
|
| c.c:4:5:4:6 | ks | array of 4 {int} | 1 |
|
|
| c.c:6:5:6:6 | ls | array of 4 {int} | 1 |
|
|
| c.c:8:5:8:7 | iss | array of 4 {array of 2 {int}} | 1 |
|
|
| c.c:12:11:12:11 | i | typedef {int} as "int_alias" | 1 |
|
|
| d.cpp:3:7:3:8 | xs | array of {int} | 1 |
|
|
| file://:0:0:0:0 | (unnamed parameter 0) | reference to {const {struct __va_list_tag}} | 1 |
|
|
| file://:0:0:0:0 | (unnamed parameter 0) | rvalue reference to {struct __va_list_tag} | 1 |
|
|
| file://:0:0:0:0 | fp_offset | unsigned int | 1 |
|
|
| file://:0:0:0:0 | gp_offset | unsigned int | 1 |
|
|
| file://:0:0:0:0 | overflow_arg_area | pointer to {void} | 1 |
|
|
| file://:0:0:0:0 | reg_save_area | pointer to {void} | 1 |
|