[clang] [LifetimeSafety] Fix crash on explicit object member functions (PR #212154)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 00:50:31 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()) {
----------------
arhwx wrote:
My last sentence was actually wrong, it looks like recording a moved fact for the object argument also skips marking the `lifetimebound` escape verified, so it can make `-Wlifetime-safety-lifetimebound-violation` fire on code trunk accepts, rather than just rewording an existing warning. The new commit skips the explicit object parameter and also includes a test for it, though I can do it differently if needed.
I added your example to the tests too, it segfaults without the fix, thanks for the paranoia.
https://github.com/llvm/llvm-project/pull/212154
More information about the cfe-commits
mailing list