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 /lld/COFF/InputFiles.cpp | |
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
Diffstat (limited to 'lld/COFF/InputFiles.cpp')
-rw-r--r-- | lld/COFF/InputFiles.cpp | 5 |
1 files changed, 2 insertions, 3 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(); } |