diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -233,7 +233,7 @@ if (!result) return; - inputFiles.push_back(make(std::move(*result))); + inputFiles.push_back(make(**result)); break; } default: diff --git a/lld/MachO/InputFiles.h b/lld/MachO/InputFiles.h --- a/lld/MachO/InputFiles.h +++ b/lld/MachO/InputFiles.h @@ -75,7 +75,7 @@ // .dylib file class DylibFile : public InputFile { public: - explicit DylibFile(std::shared_ptr interface, + explicit DylibFile(const llvm::MachO::InterfaceFile &interface, DylibFile *umbrella = nullptr); // Mach-O dylibs can re-export other dylibs as sub-libraries, meaning that the diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -384,13 +384,12 @@ } } -DylibFile::DylibFile(std::shared_ptr interface, - DylibFile *umbrella) +DylibFile::DylibFile(const InterfaceFile &interface, DylibFile *umbrella) : InputFile(DylibKind, MemoryBufferRef()) { if (umbrella == nullptr) umbrella = this; - dylibName = saver.save(interface->getInstallName()); + dylibName = saver.save(interface.getInstallName()); auto addSymbol = [&](const Twine &name) -> void { symbols.push_back(symtab->addDylib(saver.save(name), umbrella, /*isWeakDef=*/false, @@ -398,7 +397,7 @@ }; // TODO(compnerd) filter out symbols based on the target platform // TODO: handle weak defs, thread locals - for (const auto symbol : interface->symbols()) { + for (const auto symbol : interface.symbols()) { if (!symbol->getArchitectures().has(config->arch)) continue; @@ -423,8 +422,8 @@ // TODO(compnerd) properly represent the hierarchy of the documents as it is // in theory possible to have re-exported dylibs from re-exported dylibs which // should be parent'ed to the child. - for (auto document : interface->documents()) - reexported.push_back(make(document, umbrella)); + for (const std::shared_ptr &intf : interface.documents()) + reexported.push_back(make(*intf, umbrella)); } ArchiveFile::ArchiveFile(std::unique_ptr &&f)