[clang] Add support for capture_by on method declarations (PR #219423)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 04:32:05 PDT 2026
================
@@ -252,19 +252,62 @@ void initializer_list_capture() {
// Implicit object param 'this' is captured
// ****************************************************************************
namespace this_is_captured {
-struct X {} x;
+struct X {} x; // cfg-note {{this global dangles}}
struct S {
void capture(X &x) [[clang::lifetime_capture_by(x)]];
----------------
usx95 wrote:
nit: consider renaming into `gets_captured_by` or something to distinguish between "this gets captured" vs "this captures something"
https://github.com/llvm/llvm-project/pull/219423
More information about the cfe-commits
mailing list