[PATCH] [Analyzer] Implementation of UnaryPlusChecker
Jordan Rose
jordan_rose at apple.com
Thu Apr 18 15:02:51 PDT 2013
>
>
> Concerning ideas on how the UnaryPlusChecker checker could be improved. What about detecting "=+" written instead of "+=" as in the following test:
>
> void test() {
> unsigned int i = 7;
> i =+ i; // d you mean '+=' ?
> i =+ 7; // did you mean '+=' ?
> }
>
> What do you think?
Clang already does this, as a compiler warning:
<stdin>:3:6: warning: use of unary operator that may be intended as compound
assignment (+=)
i =+ i; // d you mean '+=' ?
^~
<stdin>:4:6: warning: use of unary operator that may be intended as compound
assignment (+=)
i =+ 7; // did you mean '+=' ?
^~
…so I think we're good. :-)
Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130418/b50280c2/attachment.html>
More information about the cfe-commits
mailing list