[ELF] Simplify addFile. NFC

This commit is contained in:
Fangrui Song 2022-10-02 19:49:17 -07:00
parent 2d2737667e
commit c171250e38
1 changed files with 2 additions and 2 deletions

View File

@ -239,8 +239,9 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
readLinkerScript(mbref);
return;
case file_magic::archive: {
auto members = getArchiveMembers(mbref);
if (inWholeArchive) {
for (const auto &p : getArchiveMembers(mbref)) {
for (const std::pair<MemoryBufferRef, uint64_t> &p : members) {
if (isBitcode(p.first))
files.push_back(make<BitcodeFile>(p.first, path, p.second, false));
else
@ -249,7 +250,6 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
return;
}
auto members = getArchiveMembers(mbref);
archiveFiles.emplace_back(path, members.size());
// Handle archives and --start-lib/--end-lib using the same code path. This