diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-07-14 21:28:07 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-07-14 21:28:07 +0000 |
commit | 9f141efc57812d3629082afc5520b182e38567e3 (patch) | |
tree | 00c4a71da18f4c61863e05fd111e4fa8cb9cc25b | |
parent | 9fab370d79eb8c09bff29a8c0744060a15d63607 (diff) | |
download | bcm5719-llvm-9f141efc57812d3629082afc5520b182e38567e3.tar.gz bcm5719-llvm-9f141efc57812d3629082afc5520b182e38567e3.zip |
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.
llvm-svn: 242205
-rw-r--r-- | lld/COFF/InputFiles.cpp | 5 | ||||
-rw-r--r-- | lld/COFF/InputFiles.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 66d792ba4cf..d9312f633f3 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -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::getMember(const Archive::Symbol *Sym) { 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(); } diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h index 0d768c52ea2..361d97d8af1 100644 --- a/lld/COFF/InputFiles.h +++ b/lld/COFF/InputFiles.h @@ -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; }; |