[lld] [lld][WebAssembly] Match the ELF linker in transitioning away from archive indexes. (PR #78658)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 09:00:02 PST 2024


================
@@ -256,10 +257,12 @@ void LinkerDriver::addFile(StringRef path) {
     if (fs::exists(importFile))
       readImportFile(importFile.str());
 
+    auto members = getArchiveMembers(mbref);
+
     // Handle -whole-archive.
     if (inWholeArchive) {
-      for (MemoryBufferRef &m : getArchiveMembers(mbref)) {
-        auto *object = createObjectFile(m, path);
+      for (const std::pair<MemoryBufferRef, uint64_t> &p : members) {
----------------
dschuff wrote:

This could be more concise as something like `for (const auto [mbref, _] : members)` here and below.

https://github.com/llvm/llvm-project/pull/78658


More information about the llvm-commits mailing list