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

Richard Smith richard at metafoo.co.uk
Fri Mar 23 13:10:03 PDT 2012


Hi Rafael,

2012/3/23 Rafael EspĂ­ndola <rafael.espindola at gmail.com>

> The attached llvm patch adds documentation and verification for the
> range metadata. I will send a patch with optimzation and analysis once
> this one is in.
>
> The clang patch makes it produce the metadata for boolean and enum
> loads. CCIng dgregor to make sure I got the enum ranges right. I
> particular I am not sure what is the correct way to check for fixed
> underlying types. Should I use the isFIxed method or look in
> IntegerType?
>

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.

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].

Thanks,
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120323/1f8e6ad5/attachment.html>


More information about the llvm-commits mailing list