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

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 05:56:46 PST 2024


================
@@ -3951,7 +3958,7 @@ The capturing entity ``X`` can be one of the following:
       std::set<std::string_view> s;
     };
 
-- 'global', 'unknown' (without quotes).
+- `global`, `unknown`.
----------------
usx95 wrote:

Sorry. I misunderstood your comment. I thought you were referring to a global within quotes here.
> ```cpp
> void captureInt(const int &i [[clang::lifetime_capture_by(global)]],
>                X &global);
> ```
This is already tested and was done as part of the syntax related changes for the annotation [PR](https://github.com/llvm/llvm-project/pull/115823), we would give:
`parameter cannot be named 'global' while using 'lifetime_capture_by(global)'`

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


More information about the cfe-commits mailing list