<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79447>79447</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] readability-implicit-bool-conversion.AllowPointerConditions not honored
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
adesitter
</td>
</tr>
</table>
<pre>
$ cat bool1.cpp
#include <cstdio>
bool OpenR(const char* filename) {
auto* file_ = fopen(filename, "rb");
return !file_;
}
$ /usr/local/clang-17/bin/clang-tidy -config="{Checks: '-*,readability-implicit-bool-conversion', CheckOptions: [{key: readability-implicit-bool-conversion.AllowPointerConditions, value: true}, {key: readability-implicit-bool-conversion.AllowIntegerConditions, value: true}]}" bool1.cpp --
1 warning generated.
/tmp/bool1.cpp:4:11: warning: implicit conversion 'FILE *' (aka '_IO_FILE *') -> bool [readability-implicit-bool-conversion]
4 | return !file_;
| ~^
| == nullptr
Since readability-implicit-bool-conversion.AllowPointerConditions is set to true, the warning should not be emitted.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVNFurDgM_RrzYjECA83wwMPMUKRKK3W1-wFVAA9km0lQEnrVl_32VZhLW11ptVd78zATYp8T-9iO9F5NhrmB6gxVm8g1zNY1cmSvQmCX9HZ8b4BKHGTA3lqdH4ZlQchayE5AhTKDXkdGKC6DD6OyUDzejdEZnxc2fwAdB2t8wGGWDuiEV6XZyBsD1QjifPdHuQa7W18QihavdmEDdPz0vyAQuR6IgGoodig6DqszCJRv6A8LiHYPtUSgbvUOqNN2kBqoG7Q0U5oLoK5X5uMgqPEd08Gaq5qgaONl4nyZeXj1UJwQSKRAJ6CLYznKXmkV3lN1W7QaVEhj3hH8xs4ra4BEDHuDPy9BWXMnqc4gzq_8Hj9-hudw0tp--90qE9hdrBnVnYsu-Cb1ypEnuJVjxlGm_0H-ZAJP_0letdsV9KUb0vQuco7fpDPKTDixYScDj4dd_i7clqjzDoLiVEJxyvPI_R0Wt3uI-BldVLx7-u0RN9UFAh3lq4ynL0_PL18ssZ9SKB630KLEP1Wgqt27CLFEEBf8937CbUWfv6F63PY_nP-4YgMVLZpV6yW472psv38qM_Cv1B6VR88Bg70Xhy4YZv6ogZ_tqkc0NmDPyLc40Hs9krEpxrqoZcJNLrKH_FgfyyqZm3w85hnJuhdZ_5AX8khH0eckjvVVXotMJKqhjMospyovCkHVgft6fMhEz1fuS7qOUGZ8k0oftH67HaybEuX9yo2oy1IkWvas_fbcEH2OW5yxqk1cE0Fpv04eykwrH_wnTVBBbw_VF1jV_pKAUZvZGut4TFanmzmEJY4nUAfUTSrMa38Y7C2-Gfpt_0sXZ__iIQB1W2oeqNuy-ycAAP__S2-r9g">