[lld] r190253 - Change the parseFile argument from MemoryBuffer pointer to LinkerInput

Joerg Sonnenberger joerg at bec.de
Sat Sep 7 10:55:29 PDT 2013


Author: joerg
Date: Sat Sep  7 12:55:28 2013
New Revision: 190253

URL: http://llvm.org/viewvc/llvm-project?rev=190253&view=rev
Log:
Change the parseFile argument from MemoryBuffer pointer to LinkerInput
reference. Move readFile logic into FileNode::createLinkerInput.

Added:
    lld/trunk/include/lld/Core/LinkerInput.h
      - copied, changed from r190104, lld/trunk/include/lld/Driver/LinkerInput.h
Removed:
    lld/trunk/include/lld/Driver/LinkerInput.h
Modified:
    lld/trunk/include/lld/Core/LinkingContext.h
    lld/trunk/include/lld/Driver/CoreInputGraph.h
    lld/trunk/include/lld/Driver/DarwinInputGraph.h
    lld/trunk/include/lld/Driver/InputGraph.h
    lld/trunk/include/lld/Driver/WinLinkInputGraph.h
    lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/Reader.h
    lld/trunk/include/lld/ReaderWriter/ReaderArchive.h
    lld/trunk/include/lld/ReaderWriter/ReaderLinkerScript.h
    lld/trunk/lib/Core/LinkingContext.cpp
    lld/trunk/lib/Driver/CoreDriver.cpp
    lld/trunk/lib/Driver/DarwinLdDriver.cpp
    lld/trunk/lib/Driver/Driver.cpp
    lld/trunk/lib/Driver/GnuLdDriver.cpp
    lld/trunk/lib/Driver/InputGraph.cpp
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
    lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
    lld/trunk/lib/ReaderWriter/Reader.cpp
    lld/trunk/lib/ReaderWriter/ReaderArchive.cpp
    lld/trunk/lib/ReaderWriter/ReaderLinkerScript.cpp
    lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
    lld/trunk/unittests/DriverTests/DriverTest.h

Copied: lld/trunk/include/lld/Core/LinkerInput.h (from r190104, lld/trunk/include/lld/Driver/LinkerInput.h)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkerInput.h?p2=lld/trunk/include/lld/Core/LinkerInput.h&p1=lld/trunk/include/lld/Driver/LinkerInput.h&r1=190104&r2=190253&rev=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/LinkerInput.h (original)
+++ lld/trunk/include/lld/Core/LinkerInput.h Sat Sep  7 12:55:28 2013
@@ -45,40 +45,37 @@ class LinkerInput {
   LinkerInput(const LinkerInput &) LLVM_DELETED_FUNCTION;
 
 public:
-  explicit LinkerInput(StringRef file)
-      : _file(file), _isForceLoad(false), _asNeeded(false) {}
-
-  explicit LinkerInput(std::unique_ptr<llvm::MemoryBuffer> buffer)
-      : _buffer(std::move(buffer)), _file(_buffer->getBufferIdentifier()),
-        _isForceLoad(false), _asNeeded(false) {}
+  explicit LinkerInput(std::unique_ptr<llvm::MemoryBuffer> buffer,
+                       StringRef userPath)
+      : _buffer(std::move(buffer)), _userPath(userPath), _isForceLoad(false),
+        _asNeeded(false) {}
+
+  explicit LinkerInput(std::unique_ptr<llvm::MemoryBuffer> buffer,
+                       const LinkerInput &other)
+      : _buffer(std::move(buffer)), _userPath(other.getUserPath()),
+        _isForceLoad(other.isForceLoad()), _asNeeded(other.asNeeded()) {}
 
   LinkerInput(LinkerInput &&other)
-      : _buffer(std::move(other._buffer)), _file(std::move(other._file)),
+      : _buffer(std::move(other._buffer)), _userPath(std::move(other._userPath)),
         _isForceLoad(other.isForceLoad()), _asNeeded(other.asNeeded()) {}
 
   LinkerInput &operator=(LinkerInput &&rhs) {
     _buffer = std::move(rhs._buffer);
-    _file = std::move(rhs._file);
+    _userPath = std::move(rhs._userPath);
+    _isForceLoad = rhs.isForceLoad();
+    _asNeeded = rhs.asNeeded();
     return *this;
   }
 
-  ErrorOr<llvm::MemoryBuffer&> getBuffer() const {
-    if (!_buffer) {
-      llvm::OwningPtr<llvm::MemoryBuffer> buf;
-      if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(_file, buf))
-        return ec;
-      _buffer.reset(buf.take());
-    }
+  StringRef getUserPath() const { return _userPath; }
 
+  llvm::MemoryBuffer &getBuffer() const {
+    assert(_buffer);
     return *_buffer;
   }
 
-  StringRef getPath() const {
-    return _file;
-  }
-
   std::unique_ptr<llvm::MemoryBuffer> takeBuffer() {
-    getBuffer();
+    assert(_buffer);
     return std::move(_buffer);
   }
 
@@ -96,8 +93,8 @@ public:
   bool asNeeded() const { return _asNeeded; }
 
 private:
-  mutable std::unique_ptr<llvm::MemoryBuffer> _buffer;
-  std::string _file;
+  std::unique_ptr<llvm::MemoryBuffer> _buffer;
+  std::string _userPath;
   bool _isForceLoad;
   bool _asNeeded;
 };

Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Sat Sep  7 12:55:28 2013
@@ -12,11 +12,11 @@
 
 #include "lld/Core/Error.h"
 #include "lld/Core/LLVM.h"
+#include "lld/Core/LinkerInput.h"
 #include "lld/Core/range.h"
 #include "lld/Core/Reference.h"
 
 #include "lld/Driver/InputGraph.h"
-#include "lld/Driver/LinkerInput.h"
 #include "lld/ReaderWriter/Reader.h"
 
 #include "llvm/Support/ErrorOr.h"
@@ -276,18 +276,9 @@ public:
   /// The \p result is a vector because some input files parse into more than
   /// one lld::File (e.g. YAML).
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &inputBuff,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<File> > &result) const = 0;
 
-  /// This is a wrapper around parseFile() where the input file is specified
-  /// by file system path.  The default implementation reads the input file
-  /// into a memory buffer and calls parseFile().
-  ///
-  /// \param path This is the file system path to the input file.
-  /// \param [out] result The instantiated lld::File object is returned here.
-  virtual error_code
-  readFile(StringRef path, std::vector<std::unique_ptr<File> > &result) const;
-
   /// This method is called by core linking to give the Writer a chance
   /// to add file format specific "files" to set of files to be linked. This is
   /// how file format specific atoms can be added to the link.

Modified: lld/trunk/include/lld/Driver/CoreInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/CoreInputGraph.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/CoreInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/CoreInputGraph.h Sat Sep  7 12:55:28 2013
@@ -34,9 +34,6 @@ public:
     return a->kind() == InputElement::Kind::File;
   }
 
-  virtual llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-  createLinkerInput(const lld::LinkingContext &);
-
   /// \brief validates the Input Element
   virtual bool validate() {
     (void)_ctx;

Modified: lld/trunk/include/lld/Driver/DarwinInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/DarwinInputGraph.h Sat Sep  7 12:55:28 2013
@@ -35,9 +35,6 @@ public:
     return a->kind() == InputElement::Kind::File;
   }
 
-  virtual llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-  createLinkerInput(const lld::LinkingContext &);
-
   /// \brief validates the Input Element
   virtual bool validate() {
     (void)_ctx;

Modified: lld/trunk/include/lld/Driver/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/InputGraph.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/InputGraph.h (original)
+++ lld/trunk/include/lld/Driver/InputGraph.h Sat Sep  7 12:55:28 2013
@@ -18,7 +18,7 @@
 
 #include "lld/Core/File.h"
 #include "lld/Core/LLVM.h"
-#include "lld/Driver/LinkerInput.h"
+#include "lld/Core/LinkerInput.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <memory>
@@ -232,7 +232,7 @@ public:
 
   /// \brief Create a lld::File node from the FileNode
   virtual llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-  createLinkerInput(const LinkingContext &targetInfo) = 0;
+  createLinkerInput(const LinkingContext &targetInfo);
 
 protected:
   StringRef _path;

Removed: lld/trunk/include/lld/Driver/LinkerInput.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/LinkerInput.h?rev=190252&view=auto
==============================================================================
--- lld/trunk/include/lld/Driver/LinkerInput.h (original)
+++ lld/trunk/include/lld/Driver/LinkerInput.h (removed)
@@ -1,107 +0,0 @@
-//===- lld/Core/LinkerInput.h - Files to be linked ------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-///
-/// All linker options needed by core linking.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_CORE_LINKER_INPUT_H
-#define LLD_CORE_LINKER_INPUT_H
-
-#include "lld/Core/LLVM.h"
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/ADT/Triple.h"
-#include "llvm/Option/ArgList.h"
-#include "llvm/Option/Option.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/MemoryBuffer.h"
-
-#include <memory>
-#include <vector>
-
-namespace lld {
-
-/// \brief An input to the linker.
-///
-/// This class represents an input to the linker. It create the MemoryBuffer
-/// lazily when needed based on the file path. It can also take a MemoryBuffer
-/// directly.
-///
-/// The intent is that we only open each file once. And have strong ownership
-/// semantics.
-class LinkerInput {
-  LinkerInput(const LinkerInput &) LLVM_DELETED_FUNCTION;
-
-public:
-  explicit LinkerInput(StringRef file)
-      : _file(file), _isForceLoad(false), _asNeeded(false) {}
-
-  explicit LinkerInput(std::unique_ptr<llvm::MemoryBuffer> buffer)
-      : _buffer(std::move(buffer)), _file(_buffer->getBufferIdentifier()),
-        _isForceLoad(false), _asNeeded(false) {}
-
-  LinkerInput(LinkerInput &&other)
-      : _buffer(std::move(other._buffer)), _file(std::move(other._file)),
-        _isForceLoad(other.isForceLoad()), _asNeeded(other.asNeeded()) {}
-
-  LinkerInput &operator=(LinkerInput &&rhs) {
-    _buffer = std::move(rhs._buffer);
-    _file = std::move(rhs._file);
-    return *this;
-  }
-
-  ErrorOr<llvm::MemoryBuffer&> getBuffer() const {
-    if (!_buffer) {
-      llvm::OwningPtr<llvm::MemoryBuffer> buf;
-      if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(_file, buf))
-        return ec;
-      _buffer.reset(buf.take());
-    }
-
-    return *_buffer;
-  }
-
-  StringRef getPath() const {
-    return _file;
-  }
-
-  std::unique_ptr<llvm::MemoryBuffer> takeBuffer() {
-    getBuffer();
-    return std::move(_buffer);
-  }
-
-  /// \brief forceLoad is a positional option which when set, requires all
-  /// members in an archive to be force loaded
-  void setForceLoad(bool forceLoad) { _isForceLoad = forceLoad; }
-
-  bool isForceLoad() const { return _isForceLoad; }
-
-  /// \brief asneeded is a positional option which when set for a file
-  /// makes the file to be needed at runtime only if its resolving
-  /// undefined symbols
-  void setAsNeeded(bool asNeeded) { _asNeeded = asNeeded; }
-
-  bool asNeeded() const { return _asNeeded; }
-
-private:
-  mutable std::unique_ptr<llvm::MemoryBuffer> _buffer;
-  std::string _file;
-  bool _isForceLoad;
-  bool _asNeeded;
-};
-
-} // namespace lld
-
-#endif

Modified: lld/trunk/include/lld/Driver/WinLinkInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/WinLinkInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/WinLinkInputGraph.h Sat Sep  7 12:55:28 2013
@@ -37,9 +37,6 @@ public:
 
   virtual llvm::ErrorOr<StringRef> path(const LinkingContext &ctx) const;
 
-  virtual llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-  createLinkerInput(const lld::LinkingContext &);
-
   /// \brief validates the Input Element
   virtual bool validate() { return true; }
 
@@ -62,9 +59,6 @@ public:
 
   virtual llvm::ErrorOr<StringRef> path(const LinkingContext &ctx) const;
 
-  virtual llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-  createLinkerInput(const lld::LinkingContext &);
-
   /// \brief validates the Input Element
   virtual bool validate() { return true; }
 

Modified: lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/CoreLinkingContext.h Sat Sep  7 12:55:28 2013
@@ -28,7 +28,7 @@ public:
   virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind kind) const;
 
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<File> > &result) const;
 
   void addPassNamed(StringRef name) { _passNames.push_back(name); }

Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Sat Sep  7 12:55:28 2013
@@ -87,7 +87,7 @@ public:
   }
 
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<File> > &result) const;
 
   static std::unique_ptr<ELFLinkingContext> create(llvm::Triple);

Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Sat Sep  7 12:55:28 2013
@@ -33,7 +33,7 @@ public:
   virtual bool validateImpl(raw_ostream &diagnostics);
 
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<File> > &result) const;
 
   uint32_t getCPUType() const;

Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Sat Sep  7 12:55:28 2013
@@ -49,7 +49,7 @@ public:
   };
 
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<File> > &result) const;
 
   virtual Writer &writer() const;

Modified: lld/trunk/include/lld/ReaderWriter/Reader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Reader.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Reader.h Sat Sep  7 12:55:28 2013
@@ -32,15 +32,11 @@ class Reader {
 public:
   virtual ~Reader();
 
-  /// \brief Parse a file given its file system path and create a File object.
-  virtual error_code readFile(StringRef path,
-                              std::vector<std::unique_ptr<File>> &result) const;
-
   /// \brief Parse a supplied buffer (already filled with the contents of a
   /// file) and create a File object.
   ///
   /// On success, the resulting File object takes ownership of the MemoryBuffer.
-  virtual error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  virtual error_code parseFile(LinkerInput &input,
                           std::vector<std::unique_ptr<File>> &result) const = 0;
 
 protected:

Modified: lld/trunk/include/lld/ReaderWriter/ReaderArchive.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ReaderArchive.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ReaderArchive.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ReaderArchive.h Sat Sep  7 12:55:28 2013
@@ -34,7 +34,7 @@ public:
 
   /// \brief Returns a vector of Files that are contained in the archive file
   ///        pointed to by the Memorybuffer
-  error_code parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb,
+  error_code parseFile(LinkerInput &input,
                        std::vector<std::unique_ptr<File>> &result) const;
 
 private:

Modified: lld/trunk/include/lld/ReaderWriter/ReaderLinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ReaderLinkerScript.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/ReaderLinkerScript.h (original)
+++ lld/trunk/include/lld/ReaderWriter/ReaderLinkerScript.h Sat Sep  7 12:55:28 2013
@@ -26,7 +26,7 @@ public:
 
   /// \brief Returns a vector of Files that are contained in the archive file
   ///        pointed to by the Memorybuffer
-  error_code parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb,
+  error_code parseFile(LinkerInput &input,
                        std::vector<std::unique_ptr<File>> &result) const;
 };
 

Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Sat Sep  7 12:55:28 2013
@@ -33,17 +33,6 @@ bool LinkingContext::validate(raw_ostrea
   return validateImpl(diagnostics);
 }
 
-error_code
-LinkingContext::readFile(StringRef path,
-                         std::vector<std::unique_ptr<File>> &result) const {
-  OwningPtr<llvm::MemoryBuffer> opmb;
-  if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, opmb))
-    return ec;
-
-  std::unique_ptr<MemoryBuffer> mb(opmb.take());
-  return this->parseFile(mb, result);
-}
-
 error_code LinkingContext::writeFile(const File &linkedFile) const {
   return this->writer().writeFile(linkedFile, _outputPath);
 }

Modified: lld/trunk/lib/Driver/CoreDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CoreDriver.cpp (original)
+++ lld/trunk/lib/Driver/CoreDriver.cpp Sat Sep  7 12:55:28 2013
@@ -66,11 +66,6 @@ public:
 
 namespace lld {
 
-llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-COREFileNode::createLinkerInput(const LinkingContext &info) {
-  return std::unique_ptr<LinkerInput>(new LinkerInput(*path(info)));
-}
-
 bool CoreDriver::link(int argc, const char *argv[], raw_ostream &diagnostics) {
   CoreLinkingContext info;
   if (parse(argc, argv, info))

Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Sat Sep  7 12:55:28 2013
@@ -70,11 +70,6 @@ public:
 
 namespace lld {
 
-llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-MachOFileNode::createLinkerInput(const LinkingContext &ctx) {
-  return std::unique_ptr<LinkerInput>(new LinkerInput(*path(ctx)));
-}
-
 bool DarwinLdDriver::linkMachO(int argc, const char *argv[],
                                raw_ostream &diagnostics) {
   MachOLinkingContext ctx;

Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Sat Sep  7 12:55:28 2013
@@ -68,11 +68,11 @@ bool Driver::link(const LinkingContext &
   }
   for (const auto &input : linkerInputs) {
     if (context.logInputFiles())
-      llvm::outs() << input->getPath() << "\n";
+      llvm::outs() << input->getUserPath() << "\n";
 
     tg.spawn([ &, index]{
-      if (error_code ec = context.readFile(input->getPath(), files[index])) {
-        diagnostics << "Failed to read file: " << input->getPath() << ": "
+      if (error_code ec = context.parseFile(*input, files[index])) {
+        diagnostics << "Failed to read file: " << input->getUserPath() << ": "
                     << ec.message() << "\n";
         fail = true;
         return;

Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Sat Sep  7 12:55:28 2013
@@ -71,13 +71,12 @@ public:
 
 llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
 ELFFileNode::createLinkerInput(const LinkingContext &ctx) {
-  auto filePath = path(ctx);
-  if (!filePath &&
-      error_code(filePath) == llvm::errc::no_such_file_or_directory)
-    return make_error_code(llvm::errc::no_such_file_or_directory);
-  std::unique_ptr<LinkerInput> inputFile(new LinkerInput(*filePath));
-  inputFile->setAsNeeded(_asNeeded);
-  inputFile->setForceLoad(_isWholeArchive);
+  auto inputFile(FileNode::createLinkerInput(ctx));
+
+  if (inputFile) {
+    (*inputFile)->setAsNeeded(_asNeeded);
+    (*inputFile)->setForceLoad(_isWholeArchive);
+  }
   return std::move(inputFile);
 }
 

Modified: lld/trunk/lib/Driver/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/InputGraph.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/InputGraph.cpp (original)
+++ lld/trunk/lib/Driver/InputGraph.cpp Sat Sep  7 12:55:28 2013
@@ -54,3 +54,18 @@ bool InputGraph::dump(raw_ostream &diagn
       return false;
   return true;
 }
+
+llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
+FileNode::createLinkerInput(const LinkingContext &ctx) {
+  auto filePath = path(ctx);
+  if (!filePath &&
+      error_code(filePath) == llvm::errc::no_such_file_or_directory)
+    return make_error_code(llvm::errc::no_such_file_or_directory);
+  OwningPtr<llvm::MemoryBuffer> opmb;
+  if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(*filePath, opmb))
+    return ec;
+
+  std::unique_ptr<MemoryBuffer> mb(opmb.take());
+
+  return std::unique_ptr<LinkerInput>(new LinkerInput(std::move(mb), *filePath));
+}

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Sat Sep  7 12:55:28 2013
@@ -212,16 +212,6 @@ parseArgs(int argc, const char *argv[],
 
 } // namespace
 
-llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-PECOFFFileNode::createLinkerInput(const LinkingContext &ctx) {
-  return std::unique_ptr<LinkerInput>(new LinkerInput(*path(ctx)));
-}
-
-llvm::ErrorOr<std::unique_ptr<lld::LinkerInput> >
-PECOFFLibraryNode::createLinkerInput(const LinkingContext &ctx) {
-  return std::unique_ptr<LinkerInput>(new LinkerInput(*path(ctx)));
-}
-
 llvm::ErrorOr<StringRef> PECOFFFileNode::path(const LinkingContext &) const {
   if (_path.endswith(".lib"))
     return _ctx.searchLibraryFile(_path);

Modified: lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp Sat Sep  7 12:55:28 2013
@@ -288,12 +288,11 @@ void CoreLinkingContext::addPasses(PassM
   }
 }
 
-error_code CoreLinkingContext::parseFile(
-    std::unique_ptr<MemoryBuffer> &mb,
+error_code CoreLinkingContext::parseFile(LinkerInput &input,
     std::vector<std::unique_ptr<File>> &result) const {
   if (!_reader)
     _reader = createReaderYAML(*this);
-  return _reader->parseFile(mb, result);
+  return _reader->parseFile(input, result);
 }
 
 Writer &CoreLinkingContext::writer() const {

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Sat Sep  7 12:55:28 2013
@@ -98,24 +98,23 @@ bool ELFLinkingContext::isRelativeReloc(
   return false;
 }
 
-error_code ELFLinkingContext::parseFile(
-    std::unique_ptr<MemoryBuffer> &mb,
+error_code ELFLinkingContext::parseFile(LinkerInput &input,
     std::vector<std::unique_ptr<File>> &result) const {
   ScopedTask task(getDefaultDomain(), "parseFile");
-  error_code ec = _elfReader->parseFile(mb, result);
+  error_code ec = _elfReader->parseFile(input, result);
   if (!ec)
     return ec;
 
   // Not an ELF file, check file extension to see if it might be yaml
-  StringRef path = mb->getBufferIdentifier();
+  StringRef path = input.getBuffer().getBufferIdentifier();
   if (path.endswith(".objtxt")) {
-    ec = _yamlReader->parseFile(mb, result);
+    ec = _yamlReader->parseFile(input, result);
     if (!ec)
       return ec;
   }
 
   // Not a yaml file, assume it is a linkerscript
-  return _linkerScriptReader->parseFile(mb, result);
+  return _linkerScriptReader->parseFile(input, result);
 }
 
 Writer &ELFLinkingContext::writer() const { return *_writer; }

Modified: lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Reader.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Reader.cpp Sat Sep  7 12:55:28 2013
@@ -81,21 +81,22 @@ public:
   ELFReader(const ELFLinkingContext &ctx)
       : lld::Reader(ctx), _elfLinkingContext(ctx), _readerArchive(ctx, *this) {}
 
-  error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  error_code parseFile(LinkerInput &input,
                        std::vector<std::unique_ptr<File>> &result) const {
     using llvm::object::ELFType;
+    llvm::MemoryBuffer &mb(input.getBuffer());
     llvm::sys::fs::file_magic FileType =
-        llvm::sys::fs::identify_magic(mb->getBuffer());
+        llvm::sys::fs::identify_magic(mb.getBuffer());
 
     std::size_t MaxAlignment =
-        1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+        1ULL << llvm::countTrailingZeros(uintptr_t(mb.getBufferStart()));
 
     llvm::error_code ec;
     switch (FileType) {
     case llvm::sys::fs::file_magic::elf_relocatable: {
       std::unique_ptr<File> f(createELF<ELFFileCreateELFTraits>(
-          getElfArchType(&*mb), MaxAlignment, _elfLinkingContext, std::move(mb),
-          ec));
+          getElfArchType(&mb), MaxAlignment, _elfLinkingContext,
+          std::move(input.takeBuffer()), ec));
       if (ec)
         return ec;
       result.push_back(std::move(f));
@@ -107,15 +108,15 @@ public:
       if (!_elfLinkingContext.allowLinkWithDynamicLibraries())
         return llvm::make_error_code(llvm::errc::executable_format_error);
       auto f = createELF<DynamicFileCreateELFTraits>(
-          getElfArchType(&*mb), MaxAlignment, _elfLinkingContext,
-          std::move(mb));
+          getElfArchType(&mb), MaxAlignment, _elfLinkingContext,
+          std::move(input.takeBuffer()));
       if (!f)
         return f;
       result.push_back(std::move(*f));
       break;
     }
     case llvm::sys::fs::file_magic::archive:
-      ec = _readerArchive.parseFile(mb, result);
+      ec = _readerArchive.parseFile(input, result);
       break;
     default:
       return llvm::make_error_code(llvm::errc::executable_format_error);

Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Sat Sep  7 12:55:28 2013
@@ -234,13 +234,13 @@ void MachOLinkingContext::addPasses(Pass
 }
 
 error_code MachOLinkingContext::parseFile(
-    std::unique_ptr<MemoryBuffer> &mb,
+    LinkerInput &input,
     std::vector<std::unique_ptr<File>> &result) const {
   //  if (!_machoReader)
   //    _machoReader = createReaderMachO(*this);
-  //  error_code ec = _machoReader->parseFile(mb,result);
+  //  error_code ec = _machoReader->parseFile(input,result);
   //  if (ec) {
-  return _yamlReader->parseFile(mb, result);
+  return _yamlReader->parseFile(input, result);
   //  }
 
   return error_code::success();

Modified: lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp Sat Sep  7 12:55:28 2013
@@ -239,11 +239,11 @@ public:
   /// Instantiates a File object from a native object file.  Ownership
   /// of the MemoryBuffer is transfered to the resulting File object.
   static error_code make(const LinkingContext &context,
-                         std::unique_ptr<llvm::MemoryBuffer> &mb,
-                         StringRef path,
+                         LinkerInput &input,
                          std::vector<std::unique_ptr<lld::File>> &result) {
     const uint8_t *const base =
-        reinterpret_cast<const uint8_t *>(mb->getBufferStart());
+        reinterpret_cast<const uint8_t *>(input.getBuffer().getBufferStart());
+    StringRef path(input.getBuffer().getBufferIdentifier());
     const NativeFileHeader* const header =
                        reinterpret_cast<const NativeFileHeader*>(base);
     const NativeChunk *const chunks =
@@ -253,7 +253,7 @@ public:
       return make_error_code(native_reader_error::unknown_file_format);
 
     // make sure mapped file contains all needed data
-    const size_t fileSize = mb->getBufferSize();
+    const size_t fileSize = input.getBuffer().getBufferSize();
     if ( header->fileSize > fileSize )
       return make_error_code(native_reader_error::file_too_short);
 
@@ -263,7 +263,8 @@ public:
                                  << header->chunkCount << "\n");
 
     // instantiate NativeFile object and add values to it as found
-    std::unique_ptr<File> file(new File(context, std::move(mb), path));
+    std::unique_ptr<File> file(new File(context, std::move(input.takeBuffer()),
+                                        path));
 
     // process each chunk
     for (uint32_t i = 0; i < header->chunkCount; ++i) {
@@ -912,9 +913,9 @@ public:
   Reader(const LinkingContext &context) : lld::Reader(context) {}
 
   virtual error_code
-  parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  parseFile(LinkerInput &input,
             std::vector<std::unique_ptr<lld::File>> &result) const {
-    return File::make(_context, mb, mb->getBufferIdentifier(), result);
+    return File::make(_context, input, result);
   }
 };
 } // end namespace native

Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Sat Sep  7 12:55:28 2013
@@ -28,9 +28,9 @@ namespace lld {
 namespace {} // anonymous namespace
 
 error_code PECOFFLinkingContext::parseFile(
-    std::unique_ptr<MemoryBuffer> &mb,
+    LinkerInput &input,
     std::vector<std::unique_ptr<File>> &result) const {
-  return _reader->parseFile(mb, result);
+  return _reader->parseFile(input, result);
 }
 
 bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Sat Sep  7 12:55:28 2013
@@ -676,14 +676,15 @@ public:
       : Reader(context), _readerArchive(context, *this),
         _PECOFFLinkingContext(context) {}
 
-  error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  error_code parseFile(LinkerInput &input,
                        std::vector<std::unique_ptr<File>> &result) const {
-    StringRef magic(mb->getBufferStart(), mb->getBufferSize());
+    StringRef magic(input.getBuffer().getBufferStart(), input.getBuffer().getBufferSize());
     llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(magic);
+    if (fileType == llvm::sys::fs::file_magic::archive)
+      return _readerArchive.parseFile(input, result);
+    std::unique_ptr<MemoryBuffer> mb(input.takeBuffer());
     if (fileType == llvm::sys::fs::file_magic::coff_object)
       return parseCOFFFile(mb, result);
-    if (fileType == llvm::sys::fs::file_magic::archive)
-      return _readerArchive.parseFile(mb, result);
     return lld::coff::parseCOFFImportLibrary(_context, mb, result);
   }
 

Modified: lld/trunk/lib/ReaderWriter/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/Reader.cpp Sat Sep  7 12:55:28 2013
@@ -17,14 +17,4 @@
 namespace lld {
 Reader::~Reader() {
 }
-
-error_code Reader::readFile(StringRef path,
-                            std::vector<std::unique_ptr<File>> &result) const {
-  OwningPtr<llvm::MemoryBuffer> opmb;
-  if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, opmb))
-    return ec;
-
-  std::unique_ptr<MemoryBuffer> mb(opmb.take());
-  return this->parseFile(mb, result);
-}
 } // end namespace lld

Modified: lld/trunk/lib/ReaderWriter/ReaderArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ReaderArchive.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ReaderArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ReaderArchive.cpp Sat Sep  7 12:55:28 2013
@@ -47,8 +47,8 @@ public:
       return nullptr;
     if (_context.logInputFiles())
       llvm::outs() << buff->getBufferIdentifier() << "\n";
-    std::unique_ptr<MemoryBuffer> mb(buff.take());
-    if (_context.parseFile(mb, result))
+    LinkerInput newInput(std::unique_ptr<MemoryBuffer>(buff.take()), _input);
+    if (_context.parseFile(newInput, result))
       return nullptr;
 
     assert(result.size() == 1);
@@ -122,6 +122,7 @@ protected:
   }
 
 private:
+  LinkerInput                               _input;
   std::unique_ptr<llvm::object::Archive>    _archive;
   atom_collection_vector<DefinedAtom>       _definedAtoms;
   atom_collection_vector<UndefinedAtom>     _undefinedAtoms;
@@ -132,10 +133,11 @@ private:
 public:
   /// only subclasses of ArchiveLibraryFile can be instantiated
   FileArchive(const LinkingContext &context,
-              std::unique_ptr<llvm::MemoryBuffer> mb, error_code &ec)
-      : ArchiveLibraryFile(context, mb->getBufferIdentifier()) {
+              LinkerInput &input, error_code &ec)
+      : ArchiveLibraryFile(context, input.getBuffer().getBufferIdentifier()),
+        _input(std::move(input)) {
     std::unique_ptr<llvm::object::Archive> archive_obj(
-        new llvm::object::Archive(mb.release(), ec));
+        new llvm::object::Archive(_input.takeBuffer().release(), ec));
     if (ec)
       return;
     _archive.swap(archive_obj);
@@ -159,12 +161,12 @@ public:
 
 // Returns a vector of Files that are contained in the archive file
 // pointed to by the MemoryBuffer
-error_code ReaderArchive::parseFile(std::unique_ptr<llvm::MemoryBuffer> &mb,
+error_code ReaderArchive::parseFile(LinkerInput &input,
                             std::vector<std::unique_ptr<File>> &result) const {
   error_code ec;
 
   if (_context.forceLoadAllArchives()) {
-    _archive.reset(new llvm::object::Archive(mb.release(), ec));
+    _archive.reset(new llvm::object::Archive(input.takeBuffer().release(), ec));
     if (ec)
       return ec;
 
@@ -176,12 +178,13 @@ error_code ReaderArchive::parseFile(std:
       std::unique_ptr<MemoryBuffer> mbc(buff.take());
       if (_context.logInputFiles())
         llvm::outs() << buff->getBufferIdentifier() << "\n";
-      if ((ec = _context.parseFile(mbc, result)))
+      LinkerInput newInput(std::move(mbc), input);
+      if ((ec = _context.parseFile(newInput, result)))
         return ec;
     }
   } else {
     std::unique_ptr<File> f;
-    f.reset(new FileArchive(_context, std::move(mb), ec));
+    f.reset(new FileArchive(_context, input, ec));
     if (ec)
       return ec;
 

Modified: lld/trunk/lib/ReaderWriter/ReaderLinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ReaderLinkerScript.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ReaderLinkerScript.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ReaderLinkerScript.cpp Sat Sep  7 12:55:28 2013
@@ -19,7 +19,7 @@ using namespace script;
 namespace {
 class LinkerScriptFile : public File {
 public:
-  static ErrorOr<std::unique_ptr<LinkerScriptFile>>
+  static ErrorOr<std::unique_ptr<LinkerScriptFile> >
   create(const LinkingContext &context,
          std::unique_ptr<llvm::MemoryBuffer> mb) {
     std::unique_ptr<LinkerScriptFile> file(
@@ -56,9 +56,7 @@ public:
     return _absoluteAtoms;
   }
 
-  const LinkerScript *getScript() {
-    return _script;
-  }
+  const LinkerScript *getScript() { return _script; }
 
 private:
   LinkerScriptFile(const LinkingContext &context,
@@ -79,9 +77,8 @@ private:
 
 namespace lld {
 error_code ReaderLinkerScript::parseFile(
-    std::unique_ptr<llvm::MemoryBuffer> &mb,
-    std::vector<std::unique_ptr<File>> &result) const {
-  auto lsf = LinkerScriptFile::create(_context, std::move(mb));
+    LinkerInput &input, std::vector<std::unique_ptr<File> > &result) const {
+  auto lsf = LinkerScriptFile::create(_context, input.takeBuffer());
   if (!lsf)
     return lsf;
   const LinkerScript *ls = (*lsf)->getScript();
@@ -89,7 +86,15 @@ error_code ReaderLinkerScript::parseFile
   for (const auto &c : ls->_commands) {
     if (auto group = dyn_cast<lld::script::Group>(c))
       for (const auto &path : group->getPaths()) {
-        if (error_code ec = _context.readFile(path._path, result))
+        OwningPtr<llvm::MemoryBuffer> opmb;
+        if (error_code ec =
+                llvm::MemoryBuffer::getFileOrSTDIN(path._path, opmb))
+          return ec;
+
+        LinkerInput newInput(std::unique_ptr<llvm::MemoryBuffer>(opmb.take()),
+                             input);
+
+        if (error_code ec = _context.parseFile(newInput, result))
           return ec;
       }
   }

Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Sat Sep  7 12:55:28 2013
@@ -1350,7 +1350,7 @@ class ReaderYAML : public Reader {
 public:
   ReaderYAML(const LinkingContext &context) : Reader(context) {}
 
-  error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
+  error_code parseFile(LinkerInput &input,
                        std::vector<std::unique_ptr<File>> &result) const {
     // Note: we do not take ownership of the MemoryBuffer.  That is
     // because yaml may produce multiple File objects, so there is no
@@ -1361,7 +1361,7 @@ public:
 
     // Create YAML Input parser.
     ContextInfo context(_context);
-    llvm::yaml::Input yin(mb->getBuffer(), &context);
+    llvm::yaml::Input yin(input.getBuffer().getBuffer(), &context);
 
     // Fill vector with File objects created by parsing yaml.
     std::vector<const lld::File*> createdFiles;

Modified: lld/trunk/unittests/DriverTests/DriverTest.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/DriverTest.h?rev=190253&r1=190252&r2=190253&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/DriverTest.h (original)
+++ lld/trunk/unittests/DriverTests/DriverTest.h Sat Sep  7 12:55:28 2013
@@ -11,8 +11,8 @@
 
 #include "gtest/gtest.h"
 
+#include "lld/Core/LinkerInput.h"
 #include "lld/Driver/Driver.h"
-#include "lld/Driver/LinkerInput.h"
 
 #include "llvm/Support/raw_ostream.h"
 





More information about the llvm-commits mailing list