[lld] r242205 - Use getChildOffset instead of getBuffer for identifying a member.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jul 14 14:28:08 PDT 2015
Author: rafael
Date: Tue Jul 14 16:28:07 2015
New Revision: 242205
URL: http://llvm.org/viewvc/llvm-project?rev=242205&view=rev
Log:
Use getChildOffset instead of getBuffer for identifying a member.
I am adding support for thin archives. On those, getting the buffer
involves reading another file.
Since we only need an id in here, use the member offset in the archive.
Modified:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/InputFiles.h
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=242205&r1=242204&r2=242205&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Tue Jul 14 16:28:07 2015
@@ -76,7 +76,7 @@ std::error_code ArchiveFile::parse() {
// all members are mapped to false, which indicates all these files
// are not read yet.
for (const Archive::Child &Child : File->children())
- Seen[Child.getBuffer().data()].clear();
+ Seen[Child.getChildOffset()].clear();
return std::error_code();
}
@@ -89,8 +89,7 @@ ErrorOr<MemoryBufferRef> ArchiveFile::ge
Archive::child_iterator It = ItOrErr.get();
// Return an empty buffer if we have already returned the same buffer.
- const char *StartAddr = It->getBuffer().data();
- if (Seen[StartAddr].test_and_set())
+ if (Seen[It->getChildOffset()].test_and_set())
return MemoryBufferRef();
return It->getMemoryBufferRef();
}
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=242205&r1=242204&r2=242205&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Tue Jul 14 16:28:07 2015
@@ -107,7 +107,7 @@ private:
std::unique_ptr<Archive> File;
std::string Filename;
std::vector<Lazy *> LazySymbols;
- std::map<const char *, std::atomic_flag> Seen;
+ std::map<uint64_t, std::atomic_flag> Seen;
llvm::MallocAllocator Alloc;
};
More information about the llvm-commits
mailing list