Re-commit r225674: Convert other drivers to use WrapperNode.
The original commit had an issue with Mac OS dylib files. It didn't
handle fat binary dylib files correctly. This patch includes a fix.
A test for that case has already been committed in r225764.
llvm-svn: 226123
diff --git a/lld/lib/ReaderWriter/Reader.cpp b/lld/lib/ReaderWriter/Reader.cpp
index 8cbaae1..616f475 100644
--- a/lld/lib/ReaderWriter/Reader.cpp
+++ b/lld/lib/ReaderWriter/Reader.cpp
@@ -30,8 +30,8 @@
}
std::error_code
-Registry::parseFile(std::unique_ptr<MemoryBuffer> mb,
- std::vector<std::unique_ptr<File>> &result) const {
+Registry::loadFile(std::unique_ptr<MemoryBuffer> mb,
+ std::vector<std::unique_ptr<File>> &result) const {
// Get file type.
StringRef content(mb->getBufferStart(), mb->getBufferSize());
llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);
@@ -42,11 +42,8 @@
for (const std::unique_ptr<Reader> &reader : _readers) {
if (!reader->canParse(fileType, extension, *mb))
continue;
- if (std::error_code ec = reader->parseFile(std::move(mb), *this, result))
+ if (std::error_code ec = reader->loadFile(std::move(mb), *this, result))
return ec;
- for (std::unique_ptr<File> &file : result)
- if (std::error_code ec = file->parse())
- return ec;
return std::error_code();
}