<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57908>57908</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `performance-unnecessary-value-param` suggests to preserve unnecessary copy instead of introducing move
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          firewave
      </td>
    </tr>
</table>

<pre>
    ```cpp
#include <string>

class A
{
public:
        A(std::string s)
        : s_(std::move(s))
        {}
private:
        std::string s_;
};

extern void f1(std::string s) {
        A a{s}; // performance-unnecessary-value-param
}

extern void f3(std::string s) {
    if (!s.empty()) // performance-unnecessary-value-param
    {
            A a{s}; // no warning
    }
}
```

```
<source>:14:6: warning: parameter 's' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
        A a{s}; // performance-unnecessary-value-param
            ^
            std::move( )
<source>:17:28: warning: the parameter 's' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
extern void f3(std::string s) {
                           ^
               const      &
```

https://godbolt.org/z/x936rcvTd
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVNuS2jAM_RrnRQOTC-TykIel7H5B33ccW4DbYGdsJ7v06ysnsFBY2qWeYCRZkY6O5DRGHmqWx9Mjuo7FaxY_sTRTWrS9RGDZN-et0luWPR8Px1203Dk4KqxYTULXN60SLDvZ44pilc7LYMqepkjgWFp9OJAZ3Oul194MGPTgdelISYr1MY9VA_d4megmySvLVid467M87vju0WoYjJKwSe5AhI-yQh3ASXVTKGDpCz3Qod0Yu-da4KzXGgU6x-1hNvC2x1nHLd-fEdxLn_0zPdBSG0pasjRxc9x3_jAq1ej2IJYQ7bKyoH9anTbwxq0Ovb94cX1d0Wl6Lgu8NtIQmd4KDEOUPSUL2vLQ-FN8EkeESLxQ-oLqL0A5MjqHEpoDjGUA1xKMbg8gTKcwyCHmilTtlKR3aXYCf8qDN8BHgi_ImF5zwJarr9C1XJ8Lv8vSQ7yfFls-3xqvLwCcp_-Kv4I26v-fBPodfk7ikStCCcjFDpQejOBeGQ1N7yc--0Azd8BHKj1Y3KDFG3b5zyO7N36PcvofV-DO-pRLWhPAySXN_zKsO-87F3KPDd0a2ZjWz43dkvaLfu9VllsxfJcR1kmeZ2URL4sqknUmq6zikVe-xfAV_Ur9eQyu327ReRdGtLPo0A54PaUH6pLzyGnENyR6a2QvAi1hNqLetvUVauV3fTMXZk9K2w6nv1lnzQ8UnlTlXI_E6guBj8toV5d5U0khZZEUSVYUiyLJhYhTmcd8gxWXUcsbbF1NnWVpqvENxhAkUxcjVadxmsZVmiZlkifVXJSCo0jyOBWLuOILtohxz1U7DzgCnZGtR0hNv3V02Cri4HxIN11tNeKYjuLz3u-MrTfK4hunmsfc9Yj9N9V-_fQ">