[PATCH] New warning for mismatch between not and and/or operators.
Richard Trieu
rtrieu at google.com
Mon Oct 13 18:27:22 PDT 2014
Emit a warning when a bitwise not operator is used with a logical and/or operator or a logical not with bitwise and/or is detected. Also emit fix-it hints to change the not operator and to change the and/or operator.
Examples:
int x = ~y | ~z;
Fixed with | => ||
bool a = ~b && !c
Fixed with ~b => !b
No false positives found, although the impact of using a bitwise operator in place of a logical operator is lower than the other way round.
http://reviews.llvm.org/D5765
Files:
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5765.14839.patch
Type: text/x-patch
Size: 7319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141014/8d4f20ad/attachment.bin>
More information about the cfe-commits
mailing list