r213657 - Provide extra information in the "integer constant is too large" diagnostic. This will be used to improve other diagnostics.

Richard Smith richard at metafoo.co.uk
Tue Jul 22 17:45:08 PDT 2014


On Tue, Jul 22, 2014 at 5:38 PM, Aaron Ballman <aaron at aaronballman.com>
wrote:

> How do these sound to you?
>
> On Tue, Jul 22, 2014 at 8:13 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
> > +def err_integer_literal_too_large : Error<
> > +  "integer literal is a value that cannot be represented as
> %select{a|an}0
> > "
> > +  "%select{signed|unsigned}0 integer">;
> >
> > I don't think the "is a value that" adds anything here. Also, I'd like to
> > see something that more directly says we don't have a signed/unsigned
> > integer type large enough.
>
> "integer literal is too large to be represented in %select{a|an}0
> %select{signed|unsigned}0 integer type"


Perhaps "... to be represented in any %select{signed |}0integer type"?


> >  def err_integer_too_large : Error<
> > -  "integer constant is larger than the largest %0-bit unsigned integer
> > type">;
> > -def ext_integer_too_large_for_signed : ExtWarn<
> > -  "integer constant is larger than the largest %0-bit signed integer
> > type">,
> > +  "integer constant evaluates to value %0 that cannot be represented as
> a "
> > +  "%1-bit %select{signed|unsigned}2 integer">;
> >
> > Please rename this to something about ICEs, and move it to
> > DiagnosticSemaKinds next to the existing err_ice_ diagnostics. (This is
> > pretty similar to ext_cce_narrowing...)
> >
> >
> > +def ext_integer_literal_too_large_for_signed : ExtWarn<
> > +  "integer literal is a value that cannot be represented as a signed
> > integer, "
> > +  "and will instead be interpreted as unsigned">,
> >
> > Again, mentioning integer types and not just integers would make this
> > clearer.
>
> "integer literal is too large to be represented in a signed integer
> type, and will instead be interpreted as unsigned integer type"
>

Can we specify the type here? I think it's always 'unsigned long long' when
we reach this diagnostic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/206b95fc/attachment.html>


More information about the cfe-commits mailing list