summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/DarwinInputGraph.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-01-13 04:33:07 +0000
committerRui Ueyama <ruiu@google.com>2015-01-13 04:33:07 +0000
commite8ecb2b1445a1960a77f4b446987430f46375eb4 (patch)
tree629318f1f5273e770e34a846e291dec6b51c0c5b /lld/lib/Driver/DarwinInputGraph.cpp
parent7cceba5d767a0101303f616c1444142d43faf385 (diff)
downloadbcm5719-llvm-e8ecb2b1445a1960a77f4b446987430f46375eb4.tar.gz
bcm5719-llvm-e8ecb2b1445a1960a77f4b446987430f46375eb4.zip
Convert other drivers to use WrapperNode.
llvm-svn: 225764
Diffstat (limited to 'lld/lib/Driver/DarwinInputGraph.cpp')
-rw-r--r--lld/lib/Driver/DarwinInputGraph.cpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/lld/lib/Driver/DarwinInputGraph.cpp b/lld/lib/Driver/DarwinInputGraph.cpp
deleted file mode 100644
index 5cfef12311b..00000000000
--- a/lld/lib/Driver/DarwinInputGraph.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//===- lib/ReaderWriter/MachO/DarwinInputGraph.cpp ------------------------===//
-//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lld/Driver/DarwinInputGraph.h"
-#include "lld/Core/ArchiveLibraryFile.h"
-#include "lld/Core/DefinedAtom.h"
-#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
-#include "lld/Core/Reference.h"
-#include "lld/Core/SharedLibraryFile.h"
-
-namespace lld {
-
-
-/// \brief Parse the input file to lld::File.
-std::error_code MachOFileNode::parse(const LinkingContext &ctx,
- raw_ostream &diagnostics) {
- ErrorOr<StringRef> filePath = getPath(ctx);
- if (std::error_code ec = filePath.getError())
- return ec;
- ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr =
- MemoryBuffer::getFileOrSTDIN(*filePath);
- if (std::error_code ec = mbOrErr.getError())
- return ec;
- std::unique_ptr<MemoryBuffer> mb = std::move(mbOrErr.get());
-
- _context.addInputFileDependency(*filePath);
- if (ctx.logInputFiles())
- diagnostics << *filePath << "\n";
-
- narrowFatBuffer(mb, *filePath);
-
- std::vector<std::unique_ptr<File>> parsedFiles;
- if (std::error_code ec = ctx.registry().parseFile(std::move(mb), parsedFiles))
- return ec;
- for (std::unique_ptr<File> &pf : parsedFiles) {
- // If file is a dylib, inform LinkingContext about it.
- if (SharedLibraryFile *shl = dyn_cast<SharedLibraryFile>(pf.get())) {
- _context.registerDylib(reinterpret_cast<mach_o::MachODylibFile*>(shl),
- _upwardDylib);
- }
- // If file is an archive and -all_load, then add all members.
- if (ArchiveLibraryFile *archive = dyn_cast<ArchiveLibraryFile>(pf.get())) {
- if (_isWholeArchive) {
- // Have this node own the FileArchive object.
- _archiveFile.reset(archive);
- pf.release();
- // Add all members to _files vector
- return archive->parseAllMembers(_files);
- }
- }
- _files.push_back(std::move(pf));
- }
- return std::error_code();
-}
-
-
-/// If buffer contains a fat file, find required arch in fat buffer and
-/// switch buffer to point to just that required slice.
-void MachOFileNode::narrowFatBuffer(std::unique_ptr<MemoryBuffer> &mb,
- StringRef filePath) {
- // Check if buffer is a "fat" file that contains needed arch.
- uint32_t offset;
- uint32_t size;
- if (!_context.sliceFromFatFile(*mb, offset, size)) {
- return;
- }
- // Create new buffer containing just the needed slice.
- auto subuf = MemoryBuffer::getFileSlice(filePath, size, offset);
- if (subuf.getError())
- return;
- // The assignment to mb will release previous buffer.
- mb = std::move(subuf.get());
-}
-
-
-} // end namesapce lld
OpenPOWER on IntegriCloud