r203179 - [C++11] Replacing iterators redecls_begin() and redecls_end() with iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely.

Tobias Grosser tobias at grosser.es
Fri Mar 7 05:15:26 PST 2014


On 03/07/2014 01:40 PM, Aaron Ballman wrote:
> On Thu, Mar 6, 2014 at 7:12 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Thu, Mar 6, 2014 at 7:10 PM, Tobias Grosser <tobias at grosser.es> wrote:
>>> On 03/07/2014 12:45 AM, Aaron Ballman wrote:
>>>>
>>>> Author: aaronballman
>>>> Date: Thu Mar  6 17:45:36 2014
>>>> New Revision: 203179
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=203179&view=rev
>>>> Log:
>>>> [C++11] Replacing iterators redecls_begin() and redecls_end() with
>>>> iterator_range redecls(). Updating all of the usages of the iterators with
>>>> range-based for loops, which allows the begin/end forms to be removed
>>>> entirely.
>>>
>>>
>>> Hi Aaron,
>>>
>>> I wonder if you could use 'auto const &' in some of these cases?
>>>
>>> http://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto
>>
>> I'll look into it once I've gotten the build bots green again. Thank
>> you for the reminder. :-)
>
> I looked into this a bit more, and I'm not certain there's any real
> benefit. Everything returned from these containers is already a
> pointer, so this would change them from const Decl * to const Decl *&,
> which doesn't strike me as any better (or worse). So I am thinking I
> will continue without the const auto & in these cases (and as I move
> other pointer-based ranges forward), but thank you for the reminder!

Hi Aaron,

I follow your reasoning. It seems the coding standards are formulated a 
little to strictly. Duncan, would it make sense to put an exception
for cases like this into the standard. It seems to be a very common case 
in fact.

Tobias



More information about the cfe-commits mailing list