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

Aaron Ballman aaron at aaronballman.com
Tue Jul 22 15:31:38 PDT 2014


On Tue, Jul 22, 2014 at 4:34 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>
> On 22 Jul 2014 07:22, "Aaron Ballman" <aaron at aaronballman.com> wrote:
>>
>> Author: aaronballman
>> Date: Tue Jul 22 09:08:09 2014
>> New Revision: 213657
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=213657&view=rev
>> Log:
>> Provide extra information in the "integer constant is too large"
>> diagnostic. This will be used to improve other diagnostics.
>>
>> Modified:
>>     cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
>>     cfe/trunk/lib/Lex/PPExpressions.cpp
>>     cfe/trunk/lib/Sema/SemaExpr.cpp
>>     cfe/trunk/test/CXX/lex/lex.literal/lex.ext/p3.cpp
>>     cfe/trunk/test/Lexer/constants.c
>>     cfe/trunk/test/Sema/128bitint.c
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=213657&r1=213656&r2=213657&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Tue Jul 22
>> 09:08:09 2014
>> @@ -103,9 +103,9 @@ def warn_cxx98_compat_longlong : Warning
>>    "'long long' is incompatible with C++98">,
>>    InGroup<CXX98CompatPedantic>, DefaultIgnore;
>>  def err_integer_too_large : Error<
>> -  "integer constant is larger than the largest unsigned integer type">;
>> +  "integer constant is larger than the largest %0-bit unsigned integer
>> type">;
>
> The wording here could be better -- all 32-bit integer types are the same
> size, by definition.
>
> Perhaps "integer constant evaluates to value %0 that cannot be represented
> as a %1-bit %select{signed|unsigned}2 integer"?

Something like this?

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NumericLiteral.patch
Type: application/octet-stream
Size: 8965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/8a9873d5/attachment.obj>


More information about the cfe-commits mailing list