r297975 - Use arg_begin() instead of getArgumentList().begin(), the argument list is an implementation detail

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 08:59:15 PDT 2017


I came across llvm/docs/HistoricalNotes/2002-06-25-MegaPatchInfo.txt, which
has this:
"""
* The Function class now has helper functions for accessing the Arguments
list.
  Instead of having to go through getArgumentList for simple things like
  iterator over the arguments, now the a*() methods can be used to access
them.
"""

So, it seems like there was a desire to move away from using
getArgumentList() all the way back in 2002.

I removed getArgumentList() in a follow-up change anyway, so it's not a
public member anymore.

On Mon, Mar 20, 2017 at 8:54 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Thu, Mar 16, 2017 at 12:07 PM Reid Kleckner via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: rnk
>> Date: Thu Mar 16 13:55:46 2017
>> New Revision: 297975
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=297975&view=rev
>> Log:
>> Use arg_begin() instead of getArgumentList().begin(), the argument list
>> is an implementation detail
>>
>
> Seems like a somewhat strange justification, given that getArgumentList
> looks like a public member and probably used pervasively before LLVM moved
> towards more iterator-centric interfaces, etc.
>
> What do you mean by 'an implementation detail' in this context/what
> motivated this change? (curious what I'm missing)
>
> - Dave
>
>
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
>> CGOpenMPRuntime.cpp?rev=297975&r1=297974&r2=297975&view=diff
>> ============================================================
>> ==================
>> --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Mar 16 13:55:46 2017
>> @@ -3780,9 +3780,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFun
>>    // Emit initial values for private copies (if any).
>>    llvm::Value *TaskPrivatesMap = nullptr;
>>    auto *TaskPrivatesMapTy =
>> -      std::next(cast<llvm::Function>(TaskFunction)->
>> getArgumentList().begin(),
>> -                3)
>> -          ->getType();
>> +      std::next(cast<llvm::Function>(TaskFunction)->arg_begin(),
>> 3)->getType();
>>    if (!Privates.empty()) {
>>      auto FI = std::next(KmpTaskTWithPrivatesQTyRD->field_begin());
>>      TaskPrivatesMap = emitTaskPrivateMappingFunction(
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170320/df317f95/attachment.html>


More information about the cfe-commits mailing list