[cfe-commits] r126342 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaExpr.cpp test/Analysis/retain-release-basic-store.m test/Analysis/retain-release-gc-only.m test/Analysis/retain-release-regio

Chris Lattner clattner at apple.com
Wed Feb 23 20:57:33 PST 2011


On Feb 23, 2011, at 6:36 PM, Chandler Carruth wrote:

> On Wed, Feb 23, 2011 at 5:58 PM, Chris Lattner <clattner at apple.com> wrote:
> Mentioning the "promoted type" doesn't make sense in a lot of cases (when there is no promotion happening).  It seems completely fine to simplify it to:
> 
> "shift result (%0) requires %1 bits to represent, but %2 only has %3 bits"
> 
> What do you think?
> 
> I agree the 'promoted' part may not add much to some folks. It's a bit standards-ish. Happy to drop that part.
> 
> However, I think highlighting that the 'int' is the type of the shift expression really helps. When we found this in our code, one of the primary responses we had was:
> 
> int64_t i = 10 << 30;
> ^^^^^^
> "But it says int64_t right there!!"
> 
> Basically, I'm hoping we can educate the user on where the type came from to understand why this code is wrong.

Saying "but 'int' only has 32 bits" seems to do the trick, no?  This is a great example of a case with no promotion involved!

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110223/790642c6/attachment.html>


More information about the cfe-commits mailing list