[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 12:40:01 PST 2024


================
@@ -1889,6 +1889,36 @@ def LifetimeBound : DeclOrTypeAttr {
   let SimpleHandler = 1;
 }
 
+def LifetimeCaptureBy : DeclOrTypeAttr {
+  let Spellings = [Clang<"lifetime_capture_by", 0>];
+  let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
+  let Args = [VariadicParamOrParamIdxArgument<"Params">];
+  let Documentation = [LifetimeCaptureByDocs];
+  let AdditionalMembers = [{
+private:
+  IdentifierInfo** ArgIdents;
+  SourceLocation* ArgLocs;
----------------
hokein wrote:

Can we use `ArrayRef<IndentifierInfo*>` and `ArrayRef<SourceLocation>`? I'm not a big fan on using the raw pointers for arrays.

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


More information about the cfe-commits mailing list