[clang] [LifetimeSafety] Fix capture_by argument mapping for explicit object params (PR #228979)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 4 23:00:03 PDT 2026


================
@@ -1008,10 +1008,12 @@ void FactsGenerator::handleLifetimeCaptureBy(const FunctionDecl *FD,
   if (isa<CXXConstructorDecl>(FD))
     return;
   const auto *Method = dyn_cast<CXXMethodDecl>(FD);
-  bool IsInstance =
-      Method && Method->isInstance() && !isa<CXXConstructorDecl>(FD);
-  auto getParamDeclAt = [FD, IsInstance](unsigned I) -> const ParmVarDecl * {
-    if (IsInstance) {
+  bool HasImplicitObjectArg = Method &&
+                              Method->isImplicitObjectMemberFunction() &&
----------------
zeyi2 wrote:

Similar to the fix in: https://github.com/llvm/llvm-project/pull/212154

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


More information about the cfe-commits mailing list