[lld] r259554 - ELF: Use StringRef instead of std::string.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 12:24:31 PST 2016


Author: ruiu
Date: Tue Feb  2 14:24:31 2016
New Revision: 259554

URL: http://llvm.org/viewvc/llvm-project?rev=259554&view=rev
Log:
ELF: Use StringRef instead of std::string.

All MemoryBuffers for archive files are guaranteed to exist as long
as their children are used in the linker. So we don't need to copy
strings here. Thanks to Sean Silva for pointing this out.

Modified:
    lld/trunk/ELF/InputFiles.h

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=259554&r1=259553&r2=259554&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Feb  2 14:24:31 2016
@@ -41,7 +41,7 @@ public:
   // Filename of .a which contained this file. If this file was
   // not in an archive file, it is the empty string. We use this
   // string for creating error messages.
-  std::string ArchiveName;
+  StringRef ArchiveName;
 
 protected:
   InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {}




More information about the llvm-commits mailing list