================
@@ -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:
> Is this correct if the explicit type is not the same as the root type?
Yes. The type of an explicit object parameter has no required relationship to
the class, you can see this in the `cxx2b-deducing-this.cpp` tests, so a
predicate based on the type would be wrong here.
`isImplicitObjectMemberFunction()` only checks whether the function is static
and whether the first parameter is written with `this`, which is exactly what
decides whether `Args` and `ParmVarDecl` are offset by one. I added the deduced
and derived cases to the test, and they both segfault without the fix.
> or if the type is non-move/non-default move constructor?
The loop only tests `isRValueReferenceType()`, so `this T&&` is treated like
any other `T&&` parameter regardless of whether the move constructor is
deleted. I added a test for it too, and it segfaults without the fix.
One side effect worth noting is that `this T&&` now records a moved fact for
the object argument, while the equivalent `&&` qualified member function does
not. It only changes the wording of a warning that is already firing.
https://github.com/llvm/llvm-project/pull/212154
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits