Track lifetimes of array elements
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This is closely related to #175025
```cpp
int GLOBAL;
void use(int**);
void uas() {
int* p[3] {};
{
int a =1 ;
p[0] = &a;
}
p[1] = &GLOBAL;
use(p);
}
```
(similarly for dangling-field, uar, invalidations, etc.)
My idea is to consider an array of `int*` as 2 level origin list.
First for the array, second origin for all the elements.
This should be index-insensitive: we do not want to maintain separate origins for each element.
After:
```
p[0] = &x;
p[1] = &y;
```
we want to have loans to both 'x' and 'y' held by the inner origin of 'p';
Same is true if they are overwritten using the same index:
```
p[0] = &x;
p[0] = &y;
```
Contributor guide
Assessment
This issue has not been assessed yet.