[llvm-commits] [patch][pr12251] Add range metadata to llvm. Make clang produce it.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Mar 23 14:15:11 PDT 2012


> You should use IsFixed, as you are doing. The TypeSourceInfo* / Type*
> distinction only exists to capture whether the type was literally written in
> the source code (a scoped enumeration with no specified underlying type has
> an implicit fixed underlying type of 'int').
>
> Have you considered s/isBooleanUnderlyingType/hasBooleanRepresentation/ to
> match how you've generalized it?
>
> Please also add some test coverage for scoped enumerations.

Fixed the above comments.

> Finally, this patch does the wrong thing for an enum which is empty, or
> whose only value is 0. Such an enum has a range of representable values of
> [0, 1], not [0, 0].

Has this been changed recently? I am looking at paragraph 7 of
[dcl.enum] in n3337.  I am getting

* emin = emax = 0
* K = 1
* max(|emin| - K, |emax|) = max (-1, 0) = 0
* M = 0
* bmax = 2^M - 1 = 1 - 1 = 0

> Thanks,
> Richard

Thanks,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-patch
Size: 7343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120323/bdb7d8f9/attachment.bin>


More information about the llvm-commits mailing list