<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131215>131215</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Check request: don't use `reset` for an optional Resetable
</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>
Need a check that does all the same as https://github.com/llvm/llvm-project/issues/120908, but for `std::optional`.
Keep in mind that it's impossible to assign `nullptr` to an `std::optional` instance, use `std::nullopt` for it.
BEFORE:
```
struct A {
void reset();
};
std::optional<A> a = A{};
a->reset(); // BAD
a.reset(); // BAD
```
AFTER:
```
struct A {
void reset();
};
std::optional<A> a = A{};
(*a).reset(); // OK
a = std::nullopt; // OK
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEk8GOmzAQhp9muIw2MjaGcODgbMJlpa606gsY7AS3DqZ4WGn79JVJ0m627amHIiQQ_ufXN8P8OkZ3Gq1tQO5A7jO90BDmxtjxe5g5Y1kXzFsDTH2y1qDGfrD9V6RBE5pgI2rvkQaLUZ8t6ogD0RRBKOAt8PbkaFi6TR_OwFvvX2-Ph2kOX2xPwFsX42Ij8DbnrGZb4I_YLYTHMCOULJJJZkKFiVwYtYeSbYCpJ2sndCOe3WguNI6AVxHdeQoxus5bpICX7pLRuHg_0QwlW7-PfzNHN0bSY28TyBLtnS6ZhImSLPE5SijA1O7QPr8ckoYpKNn1ZirSvPSECqHaAVOIiK_BGZxttAR8C7wGkU6g2l9fUtFHKvGoQBxQI4g9quR1k-sHEId7N7xMHndqnwSbD6e36071nhmYUu3nw8t_6Gb1UBp4_UfqK_LzU-prrf7txyTpe9lP_Mw0wtSi1plt8qrIt3UtiyIbGlHxqpBGd9ttXUqpj-XxWDLB60rLY21Z5hrOuGQiF5zJmhUbI4UpisKyUnItRQkFs2ft_CYt9ibMp2xd6SYXOc9l5nVnfVzjxXnv9Xh6IGfegPMUt7lZ49AtpwgF8y5S_OVDjvwazHdlco-PawRn-22xkUAoNGEEXtFtXS-zu-6oHvE2eXxJB7rzNltm3_xDUi-dvTb8RwAAAP__xMs4-Q">