[cfe-commits] [PATCH] Improved handling of 128-bit integer literals

Stephen Canon scanon at apple.com
Wed Nov 21 15:48:42 PST 2012


On Nov 21, 2012, at 5:10 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> There are similar issues in 'nonnull', 'ownership' and 'format'
> attributes.  I have an incomplete patch for all these, that refactors
> duplicated code over handle*() functions in SemaDeclAttr.cpp and fixes
> this 128-bit issue, but I decided not to submit it until the semantic
> analysis is fixed.

Great, thanks.

> I see that the code is much cleaner when FitsIn* are computed upfront,
> but this leads to some extra work -- each isIntN() boils down to
> counting leading zeros.  Is there a clean way to defer the computation
> to the point where it is required?  I don't know how hot this code is,
> so maybe this is not worth doing.

In theory the compiler can do this optimization for us, at least in the common case of "small" literals (where I believe everything is in the APInt header).

> This LGTM with tests and code style changes mentioned above, but
> please wait for Richard Smith's review.

Great, I'll add the tests you requested and fix the typos in the meantime.

- Steve



More information about the cfe-commits mailing list