[PATCH] Range accessors for tablegenning attributes

Aaron Ballman aaron at aaronballman.com
Fri May 2 06:02:42 PDT 2014


On Thu, May 1, 2014 at 8:06 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Wed, Apr 30, 2014 at 11:14 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> This patch creates a range accessor for attributes during tablegen, in
>> addition to the iterators we already produce. It also updates a lot of
>> iterator usages to be range usages.
>>
>> For the most part, there should be nothing contentious here, with one
>> exception. In order to generate an accessor with a sensible
>> identifier, we may need to pluralize the identifier. Eg)
>> callableState_begin()/callableState_end() --> callableStates(), but
>> args_begin()/args_end() --> args().
>>
>> I "solved" this with a poor-man's pluralizer that makes assumptions
>> (which I've documented), but I think this is acceptable since this is
>> only for use within variadic argument objects when tablegenning
>> attributes. But I figured it was worth putting out as a patch to see
>> if there were objections or better ideas.
>
>
> The only variadic attribute argument that is not called 'Args' is called
> 'CallableState', and I think it would be clearer to rename that one
> 'CallableStates' (independent of any range-related changes). Then you can
> get rid of the pluralization mechanism entirely.

My worry was more about future variadic attribute arguments. The ones
we have today can be made to be fine, but it seems a bit strange to
force all future ones to be plural as well. Then again, "solve this
later" doesn't seem like it'd be particularly onerous either. I'll go
this route -- thanks!

~Aaron



More information about the cfe-commits mailing list