[all-commits] [llvm/llvm-project] be9dcc: [LifetimeSafety] Fix crash on explicit object memb...
arhwx via All-commits
all-commits at lists.llvm.org
Fri Aug 7 13:31:55 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: be9dcc5d877dab8e38a344c7890856fbb70bef15
https://github.com/llvm/llvm-project/commit/be9dcc5d877dab8e38a344c7890856fbb70bef15
Author: arhwx <arahwrm at gmail.com>
Date: 2026-08-07 (Fri, 07 Aug 2026)
Changed paths:
M clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
A clang/test/Sema/LifetimeSafety/explicit-object-param-no-crash.cpp
Log Message:
-----------
[LifetimeSafety] Fix crash on explicit object member functions (#212154)
`-Wlifetime-safety` crashes on a call to an explicit object member
function whose object parameter is an rvalue reference, when the call
passes at least one further argument:
```c++
struct Foo {
template <typename T>
int get(this Foo &&self, T) { return self.field; }
int field;
};
void call() { Foo().get(0); }
```
`handleMovedArgsInCall` pairs `Args[I]` with `getParamDecl(I - 1)`,
assuming the object argument has no corresponding `ParmVarDecl`. An
explicit object parameter is a `ParmVarDecl`, so the offset misaligned
them and the object parameter got paired with the following argument,
which has no origins. So the assert dereferenced the null `OriginList`.
The same offset appears in `IsArgLifetimeBound`, where it reads
`lifetimebound` off the wrong parameter instead of crashing. I have left
that for a separate change.
Fixes #204210
---------
Co-authored-by: NeKon69 <nobodqwe at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list