[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 09:12:13 PDT 2025


vbvictor wrote:

To sum up:
With `std::move` it's 1 copy 1 move for lvalue or 1 move for rvalue
With `const&` it's 1 copy for lvalue or rvalue
small repro https://godbolt.org/z/EosczKoo7

For me it this patch adds inconsistency for the check: if we have
```cpp
void NegativeMoved(ExpensiveToCopyType A) {
  ExpensiveToCopyType Copy = std::move(A); // no warning
}
```
then I remove `std::move`, I'd expect the check to suggest it, but now it wants `const&`
```



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


More information about the cfe-commits mailing list