[all-commits] [llvm/llvm-project] 8739d8: [LifetimeSafety] Introduce buildOriginFlowChain to...

Yuan Suo via All-commits all-commits at lists.llvm.org
Thu Jul 16 07:01:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8739d89c4c2475eefc4638882311515fc67f9f9b
      https://github.com/llvm/llvm-project/commit/8739d89c4c2475eefc4638882311515fc67f9f9b
  Author: Yuan Suo <suoyuan666 at s5n.xyz>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h
    M clang/lib/Analysis/LifetimeSafety/Checker.cpp
    M clang/lib/Sema/SemaLifetimeSafety.h
    M clang/test/Sema/LifetimeSafety/invalidations.cpp
    M clang/test/Sema/LifetimeSafety/safety.cpp

  Log Message:
  -----------
  [LifetimeSafety] Introduce buildOriginFlowChain to use-after-invalidation (#208891)

After completing the implementation of `buildOriginFlowChain`, we should
integrate it into the remaining diagnostics. I started with
`use-after-invalidation` because there is already an overload of
`buildOriginFlowChain` for `UseFact`.

While testing, I noticed the following diagnostics:

```txt
test.cpp:9:23: note: result of call to 'begin<std::vector<int>>' aliases the storage of parameter 'v'
    9 |   auto it = std::find(std::begin(v), std::end(v), 3); // expected-warning {{parameter 'v' is later invalidated}} \
      |                       ^~~~~~~~~~~~~
test.cpp:9:13: note: result of call to 'find<__gnu_cxx::__normal_iterator<int *, std::vector<int>>, int>' aliases the storage of parameter 'v'
    9 |   auto it = std::find(std::begin(v), std::end(v), 3); // expected-warning {{parameter 'v' is later invalidated}} \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

I think these diagnostics could be made clearer, but I'd prefer to
address that in a separate PR.

---------

Signed-off-by: Yuan Suo <suoyuan666 at s5n.xyz>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list