[clang] [LifetimeSafety] Track STL algorithm functions that return lifetimebound iterators (PR #179227)

Oliver Stöneberg via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 3 04:05:07 PST 2026


================
@@ -429,6 +429,29 @@ int *returnPtrToLocalArray() {
   return std::begin(a); // TODO
 }
 
+namespace lifetimebound_stl_algorithms {
----------------
firewave wrote:

I know these tests are only there to satisfy the patterns but they are fundamentally flawed.

They unconditionally dereference an (potentially) invalid iterator (`end()`) or use mismatching iterators (`begin()` and `end()` from two different temporary objects).

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


More information about the cfe-commits mailing list