[lld] r227543 - Explicitly write type instead of auto.

Rui Ueyama ruiu at google.com
Thu Jan 29 18:05:27 PST 2015


Yes, thanks. I just thought that avoiding auto here is more readable, but
if I use auto, I'd do that way.

On Thu, Jan 29, 2015 at 6:02 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Thu, Jan 29, 2015 at 5:52 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Thu Jan 29 19:52:23 2015
>> New Revision: 227543
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=227543&view=rev
>> Log:
>> Explicitly write type instead of auto.
>>
>> Now it is clear that std::move() is meaningless here.
>>
>> Modified:
>>     lld/trunk/include/lld/Core/Simple.h
>>
>> Modified: lld/trunk/include/lld/Core/Simple.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Simple.h?rev=227543&r1=227542&r2=227543&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/include/lld/Core/Simple.h (original)
>> +++ lld/trunk/include/lld/Core/Simple.h Thu Jan 29 19:52:23 2015
>> @@ -80,14 +80,14 @@ protected:
>>  class SimpleFileWrapper : public SimpleFile {
>>  public:
>>    SimpleFileWrapper(const File &file) : SimpleFile(file.path()) {
>> -    for (auto definedAtom : file.defined())
>> -      _definedAtoms._atoms.push_back(std::move(definedAtom));
>> -    for (auto undefAtom : file.undefined())
>> -      _undefinedAtoms._atoms.push_back(std::move(undefAtom));
>> -    for (auto shlibAtom : file.sharedLibrary())
>> -      _sharedLibraryAtoms._atoms.push_back(std::move(shlibAtom));
>> -    for (auto absAtom : file.absolute())
>> -      _absoluteAtoms._atoms.push_back(std::move(absAtom));
>> +    for (const DefinedAtom *atom : file.defined())
>>
>
> If you'd like to use auto for these, you can still demonstrate that it's a
> pointer (to const) & that's preferred by the LLVM style guide:
>
>   for (const auto *atom : file.defined())
>
> etc.
>
>
>> +      _definedAtoms._atoms.push_back(atom);
>> +    for (const UndefinedAtom *atom : file.undefined())
>> +      _undefinedAtoms._atoms.push_back(atom);
>> +    for (const SharedLibraryAtom *atom : file.sharedLibrary())
>> +      _sharedLibraryAtoms._atoms.push_back(atom);
>> +    for (const AbsoluteAtom *atom : file.absolute())
>> +      _absoluteAtoms._atoms.push_back(atom);
>>    }
>>  };
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150129/5a6b6d38/attachment.html>


More information about the llvm-commits mailing list