r203353 - [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops.

Aaron Ballman aaron at aaronballman.com
Sun Mar 9 05:41:44 PDT 2014


On Sat, Mar 8, 2014 at 8:15 PM, Chandler Carruth <chandlerc at google.com> wrote:
> Also, a separate meta-point:
>
> On Sat, Mar 8, 2014 at 10:45 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> +  typedef specific_decl_range<EnumConstantDecl> enumerator_range;
>
>
> Someone suggested this to me and I'm starting to agree -- I think we should
> stop doing typedefs because it seems unlikely that these types should be
> named by consumers at all between auto and the fact that the range itself is
> unlikely to be used as a long-lived variable or parameter. Thoughts?

I can't recall a single place where the type was written. Are you
thinking we should use the pattern:

auto foos() { return llvm::iterator_range<foo_iterator>(foo_begin(),
foo_end()); }

Also, would it make sense to add: llvm::make_range so we do not have
to spell out the iterator types?

~Aaron



More information about the cfe-commits mailing list