<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67824>67824</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
improve `misc-redundant-expression` in `if`-chains
</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
void f(char c)
{
if (c < ' ' || c == '\r' || c == ' ') {} // warning
if (c < ' ' || c == ' ' || c == '\r') {}
if (c == ' ' || c < ' ' || c == '\r') {}
if (c == '\r' || c == ' ' || c < ' ') {}
}
```
```
<source>:3:22: warning: expression is redundant [misc-redundant-expression]
3 | if (c < ' ' || c == '\r' || c == ' ') {} // warning
|
```
`c == '\r'` is redundant in all cases. Although it would be fair if the last case would not be detected.
https://godbolt.org/z/dsYY5YsEE
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2PmzAQ_TXDZZTI2HweOLDJ8h_2aMwQXDk4sk3S9tdXJtvNdpV0t5dKIMyb8Zv3xtZI7_VhJmogf4J8n8glTNY1o3Z0kWdKejv8aKBg10edTsD2wNqz1QOOwCs1SYcKeH3FoXy6LhAR9YgxA0HsEHh5fcsdlDuM4B7EPmKQ79yD0BrmNUbaMiId8A4v0s16PvxzoU8E3ArdY35E8hVrX2P-pA93i35kvi1-H9nr711Q7LxdnCIQzyBaAaLlHET71mDRIn0_OfJe2xm1R0fDMg9yDgj501F7tXlDNrdMyN_5FFH3f7oKcdtf3d87m4L96UzPKI1BJT35LbYmTHY5TKgDXuxiBuwJR6ldtBQmQiN9WJNfw7MNMWWgQCrQsH2vYArh5EG0V_EHO_TWhK11B-DdT-Dd4F9e8hf__JwMjRhqUcuEmrSoC8ZEVlTJ1BR5zgox1hkTqlQ0pD2lKeeqJtWPY54nuuGMC1bzOi1YxsstjVU2VlU-Vmkq8lpCxugotdkacz7G2on2fqGmKCueJUb2ZPw6DDif6YJrEDiPs8E1cc-mXw4eMma0D_7GEnQw1OjjydkzIRTs8fWIHZ9jih6hYBs1ST37ZHGm-dAgHaal3yp7BN7FQq-fzcnZb6QC8G6V54F3q_xfAQAA__9e3UYd">