<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122592>122592</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Add ClassIgnoreList option to misc-const-correctness
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vbvictor
</td>
</tr>
</table>
<pre>
Sometimes in large codebases we want to ignore const-correctness of certain classes because they are immutable by nature, so there is no point in adding const to them.
Minimal example:
```cpp
#include <mutex>
int main() {
std::mutex m;
std::lock_guard<std::mutex> l(m); // check is triggered but we want to ignore it since lock_guard is already immutable.
}
```
Writing NOLINT for thousands of places bloats code and is not an appealing option.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsUl1r8zYU_jXyzSHBluw6vvBFmr6BF7ruYoNdjmPpxNYqS0Y6Tpt_P-QU0rEXBMY6H4-eD0zJjp6oF82zaF4KXHkKsb8OV6s5xGII5tb_EWZiO1MC68FhHAl0MDRgogQfBB_oGTiAHX2IueYT73SIkTR7SgnCBTRFRutBO0x5bCCNayLgiW6AkcDO88o4OILhBh55jSTkCVLILbmewAdYgvWcn4HGWD_esTI2TzTvRXn8zXo7owP6xHlxJNRRlNt5Ku9HL0v-lcp67VZDINRpXpk-hfpxb80IM1ov5EHIDkT7LMojJDZ5mTpuzTALtV0_7l3Q73-PK0Yj1Om_3UL9ACfkYRayE-oZhDwLeQY9kX7PxDjacaRIBoaVf6GoZUjWa4IHRh5DFwnN7SFdFkC0L9_p3in9FS1nud5-f_359idcQgSewprQm82dxaHOpriAnDZzAb25a86AHnBZCF1eERa2we_vewvTK9OpDgvqq1Y9NZ2q6rqY-oM8lKY1sqaDGlpFZW3arpR1NRjVXExb2F6WsimrqqrKpivrfXPBi66qw-GpazQ1rahLmtG6vXPXeR_iWNiUVuorKZtOFg4HcmmLrZTaoR93bM1NSJljHPs8tRvWMYm6dDZxeuxhy24L_Lex5gWOxsApp_PnJvqrTfxFNjsx26R3_0t2sUbXT8xLym5vro6Wp3XY6zALec6YX5_dEsM_pFnI80YkCXn-4nLt5b8BAAD__6zKJ28">