[clang] [LifetimeSafety] Add warning for member functions returning field origins (PR #229784)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 02:50:33 PDT 2026


================
@@ -171,6 +174,24 @@ class LifetimeChecker {
           AnnotationWarningsMap.try_emplace(MD, ReturnEsc->getReturnExpr());
       }
     };
+    // The return value derives from a field's origin, not *this (e.g.,
+    // Span::data()), so [[clang::lifetimebound]] cannot express its lifetime.
----------------
usx95 wrote:

Changed the wording.

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


More information about the cfe-commits mailing list