[clang] [llvm] clang: fix lifetime_capture_by indexing for member functions (PR #212264)

Aditya prakash jha via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 04:06:38 PDT 2026


================
@@ -1020,12 +1020,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);
+  bool HasImplicitThisParam =
+      Method && Method->isImplicitObjectMemberFunction();
----------------
AdityaOP007 wrote:

> I think we still want to keep `&& !isa<CXXConstructorDecl>(FD)` And it would be nice to have some tests added for that.
Thanks! I'll remove the accidentally added binary file. Good point about preserving the constructor exclusion as well—I’ll restore the !isa<CXXConstructorDecl>(FD) check and add a focused regression test covering constructors.


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


More information about the llvm-commits mailing list