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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 10:37:42 PDT 2016


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

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160411/b7ce8b9c/attachment.html>


More information about the llvm-commits mailing list