[clang] [LifetimeSafety] Detect use-after-scope through fields in member calls (PR #191731)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 12 20:32:03 PDT 2026


https://github.com/usx95 commented:

Thanks. Mostly LG.

Can you also test that this works for invalidations. Something like:

```cpp
std::string GLOBAL = "global";
struct S {
    std::string_view data;
    void foo() {
        std::vector<std::string> v = {"42"};
        data = v[0];
        v.push_back("43");
        bar(); // use-after-invalidation of 'data'.
        data = GLOBAL;
    }
    void bar();
};
```

https://godbolt.org/z/o1W7h7cWo

https://github.com/llvm/llvm-project/pull/191731


More information about the cfe-commits mailing list