PATCH: Add range-for iteration adapter for Function::arg_begin/end

David Blaikie dblaikie at
Wed Mar 26 11:01:17 PDT 2014

On Wed, Mar 26, 2014 at 10:36 AM, Eli Bendersky <eliben at> wrote:
> Hello,
> This patch is in similar vein to what done earlier to
> Module::globals/aliases etc. I would really like to iterate over function
> arguments like this in new code:
>   for (Argument Arg : F.args()) {
>     ...
>   }
> The question is: would it be OK to change existing code from explicit
> iteration with the .args_begin/args_end idiom to this new idiom?

There seems to be lots of precedent for such changes already in both
Clang and LLVM - is there anything that makes this particular example
worthy of more review (see Owen Anderson, Chandler Carruth, and Aaron
Ballman's patches to LLVM and Clang doing widescale changes/migrations
to range-for).

If there's nothing particularly noteworthy about this range over the
others that have been migrated, you can probably just skip the
precommit review here. (or take my words here as sufficient precommit
review - essentially "if there's nothing special about this range, I
(David Blaikie) would feel comfortable committing this, so I'm
comfortable signing off on someone else committing it")

- David

More information about the llvm-commits mailing list