[clang] [LifetimeSafety] Document record type origin tracking for lifetimebound calls (PR #189508)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 7 09:58:59 PDT 2026


================
@@ -172,6 +172,29 @@ Without ``[[clang::lifetimebound]]`` on ``getView()``, the analysis would not
 know that the value returned by ``getView()`` depends on the temporary
 ``MyOwner`` object, and it would not be able to diagnose the dangling ``sv``.
 
+The analysis also tracks record types returned from functions and constructors
+with ``[[clang::lifetimebound]]`` annotated parameters:
+
+.. code-block:: c++
+
+  #include <string>
+
+  struct S {
+    S(const std::string &s [[clang::lifetimebound]]);
+  };
----------------
usx95 wrote:

Let's rename this struct to `StringView` to be descriptive.

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


More information about the cfe-commits mailing list