[lld] r265885 - [COFF] SmallVector<char, 0> -> SmallString<0>.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 10:44:18 PDT 2016


On Mon, Apr 11, 2016 at 10:37 AM, David Blaikie via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Might be worth just switching the loops to 'auto'? But I don't mind either
> way, just a thought.
>

We don't use `auto` unless type is obvious in a very narrow context in this
file (and other files in the same directory), so it is better to stick with
the explicit type for consistency.


> Oh, and I assume StringRef is implicitly convertible from SmallString, so
> you might be able to simplify "StringRef(Obj.data(), Obj.size())" down to
> "Obj"?
>
> On Sat, Apr 9, 2016 at 4:00 PM, Davide Italiano via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: davide
>> Date: Sat Apr  9 18:00:31 2016
>> New Revision: 265885
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=265885&view=rev
>> Log:
>> [COFF] SmallVector<char, 0> -> SmallString<0>.
>>
>> This way we're consistent between ELF and COFF.
>>
>> Modified:
>>     lld/trunk/COFF/SymbolTable.cpp
>>     lld/trunk/COFF/SymbolTable.h
>>
>> Modified: lld/trunk/COFF/SymbolTable.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=265885&r1=265884&r2=265885&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/COFF/SymbolTable.cpp (original)
>> +++ lld/trunk/COFF/SymbolTable.cpp Sat Apr  9 18:00:31 2016
>> @@ -420,7 +420,7 @@ std::vector<ObjectFile *> SymbolTable::c
>>    // Use std::list to avoid invalidation of pointers in OSPtrs.
>>    std::list<raw_svector_ostream> OSs;
>>    std::vector<raw_pwrite_stream *> OSPtrs;
>> -  for (SmallVector<char, 0> &Obj : Objs) {
>> +  for (SmallString<0> &Obj : Objs) {
>>      OSs.emplace_back(Obj);
>>      OSPtrs.push_back(&OSs.back());
>>    }
>> @@ -429,7 +429,7 @@ std::vector<ObjectFile *> SymbolTable::c
>>      error(""); // compileOptimized() should have emitted any error
>> message.
>>
>>    std::vector<ObjectFile *> ObjFiles;
>> -  for (SmallVector<char, 0> &Obj : Objs) {
>> +  for (SmallString<0> &Obj : Objs) {
>>      auto *ObjFile = new ObjectFile(
>>          MemoryBufferRef(StringRef(Obj.data(), Obj.size()), "<LTO
>> object>"));
>>      Files.emplace_back(ObjFile);
>>
>> Modified: lld/trunk/COFF/SymbolTable.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=265885&r1=265884&r2=265885&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/COFF/SymbolTable.h (original)
>> +++ lld/trunk/COFF/SymbolTable.h Sat Apr  9 18:00:31 2016
>> @@ -115,7 +115,7 @@ private:
>>    std::vector<std::future<InputFile *>> ObjectQueue;
>>
>>    std::vector<BitcodeFile *> BitcodeFiles;
>> -  std::vector<SmallVector<char, 0>> Objs;
>> +  std::vector<SmallString<0>> Objs;
>>    llvm::BumpPtrAllocator Alloc;
>>  };
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160411/2c48b62d/attachment.html>


More information about the llvm-commits mailing list