[clang] Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #115823)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 01:21:39 PST 2024
================
@@ -1889,6 +1889,43 @@ 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:
+ MutableArrayRef<IdentifierInfo*> ArgIdents;
+ MutableArrayRef<SourceLocation> ArgLocs;
+
+public:
+ static constexpr int THIS = 0;
+ static constexpr int INVALID = -1;
+ static constexpr int UNKNOWN = -2;
+ static constexpr int GLOBAL = -3;
+
+ void CreateArgs(ASTContext &Ctx) {
+ ArgIdents =
+ MutableArrayRef<IdentifierInfo *>(new (Ctx) IdentifierInfo *[params_Size], params_Size);
+ ArgLocs =
+ MutableArrayRef<SourceLocation>(new (Ctx) SourceLocation[params_Size], params_Size);
+ }
+ auto getArgIdents() const {
----------------
usx95 wrote:
Done.
https://github.com/llvm/llvm-project/pull/115823
More information about the cfe-commits
mailing list