diff options
-rw-r--r-- | lld/include/lld/Core/InputGraph.h | 14 | ||||
-rw-r--r-- | lld/include/lld/Driver/WrapperInputGraph.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lld/include/lld/Core/InputGraph.h b/lld/include/lld/Core/InputGraph.h index bf88e87c567..66116b6c218 100644 --- a/lld/include/lld/Core/InputGraph.h +++ b/lld/include/lld/Core/InputGraph.h @@ -147,6 +147,10 @@ public: : InputElement(InputElement::Kind::File), _path(path), _done(false) { } + FileNode(StringRef path, std::unique_ptr<File> f) + : InputElement(InputElement::Kind::File), _path(path), _file(std::move(f)), + _done(false) {} + virtual ErrorOr<StringRef> getPath(const LinkingContext &) const { return _path; } @@ -171,7 +175,7 @@ public: virtual void addFiles(InputGraph::FileVectorT files) { assert(files.size() == 1); assert(!_file); - _file.swap(files[0]); + _file = std::move(files[0]); } /// \brief Return the next File thats part of this node to the @@ -188,7 +192,7 @@ public: protected: StringRef _path; // The path of the Input file - std::unique_ptr<File> _file; // A vector of lld File objects + std::unique_ptr<File> _file; // An lld File object // The next file that would be processed by the resolver bool _done; @@ -199,15 +203,13 @@ class SimpleFileNode : public FileNode { public: SimpleFileNode(StringRef path) : FileNode(path) {} SimpleFileNode(StringRef path, std::unique_ptr<File> f) - : FileNode(path) { - _file.swap(f); - } + : FileNode(path, std::move(f)) {} virtual ~SimpleFileNode() {} /// \brief add a file to the list of files virtual void appendInputFile(std::unique_ptr<File> f) { - _file.swap(f); + _file = std::move(f); } }; diff --git a/lld/include/lld/Driver/WrapperInputGraph.h b/lld/include/lld/Driver/WrapperInputGraph.h index cb2a085fc3b..031982d53cb 100644 --- a/lld/include/lld/Driver/WrapperInputGraph.h +++ b/lld/include/lld/Driver/WrapperInputGraph.h @@ -21,9 +21,7 @@ namespace lld { class WrapperNode : public FileNode { public: - WrapperNode(std::unique_ptr<File> file) : FileNode(file->path()) { - _file.swap(file); - } + WrapperNode(std::unique_ptr<File> f) : FileNode(f->path(), std::move(f)) {} }; } |