[clang] [llvm] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 00:41:58 PST 2024


================
@@ -3922,16 +3922,41 @@ def LifetimeCaptureByDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{
     Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a function
-parameter or implicit object parameter indicates that that objects that are referred to
-by that parameter may also be referred to by the capturing entity ``X``.
+parameter or implicit object parameter indicates that objects that are referred to by
+that parameter may also be referred to by a capturing entity ``X``.
+
+Below is a list of types of the parameters and what they're considered to refer to:
+
+- A reference param is considered to refer to its referenced object.
----------------
hokein wrote:

It would be clearer to specify that this applies to non-view types. For a view-type reference parameter (e.g., `const std::string_view`), we consider its pointee (`owner`) rather than its referenced object.

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


More information about the cfe-commits mailing list