[lld] r252166 - Don't implicitly construct an Archive::child_iterator.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 06:34:56 PST 2015


Author: rafael
Date: Thu Nov  5 08:34:56 2015
New Revision: 252166

URL: http://llvm.org/viewvc/llvm-project?rev=252166&view=rev
Log:
Don't implicitly construct an Archive::child_iterator.

Modified:
    lld/trunk/COFF/InputFiles.cpp

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=252166&r1=252165&r2=252166&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Thu Nov  5 08:34:56 2015
@@ -74,15 +74,14 @@ void ArchiveFile::parse() {
 // Returns a buffer pointing to a member file containing a given symbol.
 // This function is thread-safe.
 MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) {
-  auto ItOrErr = Sym->getMember();
-  error(ItOrErr,
-        Twine("Could not get the member for symbol ") + Sym->getName());
-  Archive::child_iterator It = *ItOrErr;
+  auto COrErr = Sym->getMember();
+  error(COrErr, Twine("Could not get the member for symbol ") + Sym->getName());
+  const Archive::Child &C = *COrErr;
 
   // Return an empty buffer if we have already returned the same buffer.
-  if (Seen[It->getChildOffset()].test_and_set())
+  if (Seen[C.getChildOffset()].test_and_set())
     return MemoryBufferRef();
-  ErrorOr<MemoryBufferRef> Ret = It->getMemoryBufferRef();
+  ErrorOr<MemoryBufferRef> Ret = C.getMemoryBufferRef();
   error(Ret, Twine("Could not get the buffer for the member defining symbol ") +
                  Sym->getName());
   return *Ret;




More information about the llvm-commits mailing list