[cfe-commits] [Patch] Warn about missing parentheses for conditional operator
Hans Wennborg
hans at chromium.org
Wed Jun 1 05:52:56 PDT 2011
This is an attempt to address some of http://llvm.org/bugs/show_bug.cgi?id=9969
The idea is to warn about code such as:
int foo(int x, bool someCondition) {
return x + someCondition ? 42 : 0;
}
where it seems likely that the programmer forgot that ?: has lower
precedence than +.
The patch looks for condition expressions which are non-boolean binary
operators, implicitly cast to bool, where the right-hand side
expression is bool.
Please take a look!
Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_conditional_precedence.patch
Type: text/x-patch
Size: 7056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110601/28c2d15f/attachment.bin>
More information about the cfe-commits
mailing list