[llvm] r238369 - AsmPrinter: Stop exposing underlying DIEValue list, NFC

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed May 27 19:21:28 PDT 2015


According to

http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

The preferred one is foo_begin/foo_end.

Cheers,
Rafael


On 27 May 2015 at 20:09, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
>> On 2015 May 27, at 16:19, David Blaikie <dblaikie at gmail.com> wrote:
>>
>>
>>
>> On Wed, May 27, 2015 at 3:44 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>> Author: dexonsmith
>> Date: Wed May 27 17:44:06 2015
>> New Revision: 238369
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=238369&view=rev
>> Log:
>> AsmPrinter: Stop exposing underlying DIEValue list, NFC
>>
>> Change the `DIE` API to hide the implementation of the list of
>> `DIEValue`s.
>>
>> Modified:
>>     llvm/trunk/include/llvm/CodeGen/DIE.h
>>     llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp
>>     llvm/trunk/tools/dsymutil/DwarfLinker.cpp
>>
>> Modified: llvm/trunk/include/llvm/CodeGen/DIE.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=238369&r1=238368&r2=238369&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/CodeGen/DIE.h (original)
>> +++ llvm/trunk/include/llvm/CodeGen/DIE.h Wed May 27 17:44:06 2015
>> @@ -499,7 +499,16 @@ public:
>>    const std::vector<std::unique_ptr<DIE>> &getChildren() const {
>>      return Children;
>>    }
>> -  const SmallVectorImpl<DIEValue> &getValues() const { return Values; }
>> +
>> +  typedef SmallVectorImpl<DIEValue>::const_iterator value_iterator;
>> +  typedef iterator_range<value_iterator> value_range;
>> +
>> +  value_iterator begin_values() const { return Values.begin(); }
>> +  value_iterator end_values() const { return Values.end(); }
>>
>> Is this the prevailing naming convention for exposing a named range? I think we have a fair few "foo_begin/foo_end" & not sure I've seen much "end_foo/begin_foo", but I could be wrong.
>
> I actually wrote it the other way first (values_begin()), but I
> did a quick search and couldn't find any others like it.  Must
> have searched badly.  I like it your way better so I'll switch
> it back when I get a chance.
>
>> (alternatively - (optionally add range-based APIs for anything you currently need begin/end for, and) skip begin/end in favor of using the range accessor below)
>
> Yeah, it'd be nice to get rid of these entirely.  But since I
> tend to need to basically write them anyway to build the range
> accessor I usually just expose them by default.
>
> Probably easy to delete though.  I'll have a go.
>
>>
>> +  value_range values() const {
>> +    return llvm::make_range(begin_values(), end_values());
>> +  }
>> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list