<div>This patch is for a new warning to Clang, called -Wlogical-not-compare. It is designed to catch the case where the user is attempting to negate a comparison, but only manages to negate the LHS because of missing parens. For instance, warn here:</div>
<div><br></div><div> if (!x < 5)</div><div><br></div><div>The user probably meant:</div><div><br></div><div> if (!(x < 5))</div><div><br></div><div>or</div><div><br></div><div> if (x >= 5)</div><div><br>
</div><div>When emitted, the warning will have a note suggesting this as a fix-it (drop the not and inverting the comparison operator).</div><div><br></div><div>Also, a second note will be offer parenthesis around the LHS to silence this warning.</div>
<div><br></div><div> if ((!x) < 5)</div><div><br></div><div>This will not warn.</div>