[clang] Support [[clang::lifetime_capture_by(X)]] in Plain Containers (PR #204361)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 17 08:34:09 PDT 2026
================
@@ -94,6 +94,25 @@ class LifetimeAnnotatedOriginTypeCollector
CollectedTypes.push_back(RetType);
return;
}
+ if (auto *Attr = Param->getAttr<LifetimeCaptureByAttr>()) {
+ for (int Idx : Attr->params()) {
+ if (Idx == LifetimeCaptureByAttr::Global ||
+ Idx == LifetimeCaptureByAttr::Unknown ||
+ Idx == LifetimeCaptureByAttr::Invalid)
+ continue;
+ if (Idx == LifetimeCaptureByAttr::This) {
+ if (MD && MD->isInstance())
+ CollectedTypes.push_back(MD->getFunctionObjectParameterType());
+ } else if (int LogicalIdx =
+ Idx -
----------------
Xazax-hun wrote:
Nit: this formatting does not look great, I wonder if hoisting part of the expression into a bool or int might make this more reasonable.
https://github.com/llvm/llvm-project/pull/204361
More information about the cfe-commits
mailing list