[clang] [LifetimeSafety] Fix crash on explicit object member functions (PR #212154)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 26 22:59:32 PDT 2026


================
@@ -911,7 +911,8 @@ void FactsGenerator::handleMovedArgsInCall(const FunctionDecl *FD,
                                            ArrayRef<const Expr *> Args) {
   unsigned IsInstance = 0;
   if (const auto *MD = dyn_cast<CXXMethodDecl>(FD);
-      MD && MD->isInstance() && !isa<CXXConstructorDecl>(FD)) {
+      MD && !isa<CXXConstructorDecl>(FD) &&
+      MD->isImplicitObjectMemberFunction()) {
----------------
ojhunt wrote:

Right, but I'm looking at the tests in this PR

e.g. a hypothetical
```cpp
int get(this shared_ptr<NoMove> &&self, int)...
```

Or similar where there is a non-trivial/default move constructor? This is just a paranoia question from me as this is a lifetime PR


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


More information about the cfe-commits mailing list