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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Check request: readability-pass-std-string-view-by-value
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    
Since `std::string_view` is a lightweight object with reference semantic, there is no objective reason to pass it by reference.

```
void process_1(const std::string_view&) {} // INCORRECT
void process_2(std::string_view&&) {} // INCORRECT
void process_3(std::string_view) {}        // OK
```

The exception is when it was passed as an in-out parameter.

```
void process_and_change(std::string_view& sv_inout) {
    for (char c : sv_inout) {
        // a logic to process input characters...
    }
    sv_inout = get_new_token();
}
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk1GPmzoQhX_N8DICGRMgPPDAJjfS1ZXuStt9jwxMwF1ip_aQNP31lbNsd7VqVDWyAg8zn-ecwyjv9WCIasgfIN9GaubRuron88M6KUTU2v5ag2i-aNMRQiE895A1kDWenTbD_qzpAoVA7VHhpIeRLxT-0bZfqWO8aB7R0YEcBYKnozKsO5Ab5JEchUZjl2p9JnSkvDXIFk_Ke9SM7fUdkIBowinEckRztrrHk7Mdeb9PQa47azzjbweVBcgKoXyAcosgdyB3-O__m8enp382z59ZEuT6LuVvQNld0C_E8ltIj_990giieR4J6XtHJ9bWBNcuI5lgz0X5m1XUo_KoDGoT25nxpJw6EpP7k2fK9PtuVGag-4LRn_fa2JnfZhZNmPdgHQbHR-WwQ8iaO3UftCmc7KC7W8CvA6A2p5kxQFTH5HySJEsflNvl7Y2LkG1xIN4buuzZvpABuQZZQRbueq3_qDTq66yvskpFVKdllld5luZlNNaSZC7KVSHUisq2oEqtSB1kp9brgjLZRrqWQuYiFSuRpjIrk0OVVnlxOPQ9VZ3KM1gJOio9JdN0PibWDZH2fqY6lWmR5tGkWpr8bbOk7CZlhph1fwUpw6a5OnTF7Tx4WIlJe_bvHNY83XbyQ1u-xc1I3Qs6-jaT52C2I9WrVk-ar3H4BGLPffwaXByCi9trfFbTTNHspnpkPvkQ7i2IQfM4t0lnjyB34eblEZ-cDbsIcneT40HuFkXnWv4MAAD___w4TI4">