Skip to content

[alpha.webkit.UncheckedCallArgsChecker] Forwarding r-value reference should not result in a warning #142471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ bool tryToFindPtrOrigin(
}
}

if (call->isCallToStdMove() && call->getNumArgs() == 1) {
E = call->getArg(0)->IgnoreParenCasts();
continue;
}

if (auto *callee = call->getDirectCallee()) {
if (isCtorOfSafePtr(callee)) {
if (StopAtFirstRefCountedObj)
Expand Down
23 changes: 23 additions & 0 deletions clang/test/Analysis/Checkers/WebKit/call-args-checked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

#include "mock-types.h"

namespace std {

template <typename T> struct remove_reference {
typedef T type;
};

template <typename T> struct remove_reference<T&> {
typedef T type;
};

template<typename T> typename remove_reference<T>::type&& move(T&& t);

} // namespace std

RefCountableAndCheckable* makeObj();
CheckedRef<RefCountableAndCheckable> makeObjChecked();
void someFunction(RefCountableAndCheckable*);
Expand Down Expand Up @@ -54,3 +68,12 @@ void foo() {
}

}

namespace call_with_std_move {

void consume(CheckedObj&&);
void foo(CheckedObj&& obj) {
consume(std::move(obj));
}

}