diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -267,8 +267,9 @@ // We don't take a reference to cachedFile here because the // loadArchiveMember() call below may recursively call addFile() and // invalidate this reference. - if (ArchiveFile *cachedFile = loadedArchives[path]) - return cachedFile; + auto entry = loadedArchives.find(path); + if (entry != loadedArchives.end()) + return entry->second; std::unique_ptr archive = CHECK( object::Archive::create(mbref), path + ": failed to parse archive");