diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-03-01 23:52:04 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-03-01 23:52:04 +0000 |
| commit | 947648f5023cb23644cd0071bc958783f74994e4 (patch) | |
| tree | 0655267ac53e6850d5341c250da40464ed6aa7c4 | |
| parent | 958e44b17d320ebec2101c9e6d4faae7c21381be (diff) | |
| download | bcm5719-llvm-947648f5023cb23644cd0071bc958783f74994e4.tar.gz bcm5719-llvm-947648f5023cb23644cd0071bc958783f74994e4.zip | |
Make a few utility functions file-scoped.
makeErrorFile and parseMemberFiles are now used only in DarwinLdDriver.cpp.
This patch moves them to that file.
llvm-svn: 262423
| -rw-r--r-- | lld/include/lld/Driver/Driver.h | 6 | ||||
| -rw-r--r-- | lld/lib/Driver/DarwinLdDriver.cpp | 19 | ||||
| -rw-r--r-- | lld/lib/Driver/Driver.cpp | 17 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/FileArchive.cpp | 2 |
4 files changed, 20 insertions, 24 deletions
diff --git a/lld/include/lld/Driver/Driver.h b/lld/include/lld/Driver/Driver.h index d220a8fea78..e2f51aca38e 100644 --- a/lld/include/lld/Driver/Driver.h +++ b/lld/include/lld/Driver/Driver.h @@ -27,14 +27,8 @@ namespace lld { class LinkingContext; -class CoreLinkingContext; class MachOLinkingContext; -typedef std::vector<std::unique_ptr<File>> FileVector; - -FileVector makeErrorFile(StringRef path, std::error_code ec); -FileVector parseMemberFiles(std::unique_ptr<File> File); - /// Base class for all Drivers. class Driver { protected: diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp index 37348765721..31d9405fb03 100644 --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -72,6 +72,25 @@ public: DarwinLdOptTable() : OptTable(infoTable) {} }; +static std::vector<std::unique_ptr<File>> +makeErrorFile(StringRef path, std::error_code ec) { + std::vector<std::unique_ptr<File>> result; + result.push_back(llvm::make_unique<ErrorFile>(path, ec)); + return result; +} + +static std::vector<std::unique_ptr<File>> +parseMemberFiles(std::unique_ptr<File> file) { + std::vector<std::unique_ptr<File>> members; + if (auto *archive = dyn_cast<ArchiveLibraryFile>(file.get())) { + if (std::error_code ec = archive->parseAllMembers(members)) + return makeErrorFile(file->path(), ec); + } else { + members.push_back(std::move(file)); + } + return members; +} + std::vector<std::unique_ptr<File>> loadFile(MachOLinkingContext &ctx, StringRef path, raw_ostream &diag, bool wholeArchive, bool upwardDylib) { diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp index 28064cdbaed..9db986ace5e 100644 --- a/lld/lib/Driver/Driver.cpp +++ b/lld/lib/Driver/Driver.cpp @@ -29,23 +29,6 @@ namespace lld { -FileVector makeErrorFile(StringRef path, std::error_code ec) { - std::vector<std::unique_ptr<File>> result; - result.push_back(llvm::make_unique<ErrorFile>(path, ec)); - return result; -} - -FileVector parseMemberFiles(std::unique_ptr<File> file) { - std::vector<std::unique_ptr<File>> members; - if (auto *archive = dyn_cast<ArchiveLibraryFile>(file.get())) { - if (std::error_code ec = archive->parseAllMembers(members)) - return makeErrorFile(file->path(), ec); - } else { - members.push_back(std::move(file)); - } - return members; -} - void Driver::parseLLVMOptions(const LinkingContext &ctx) { // Honor -mllvm if (!ctx.llvmOptions().empty()) { diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp index 5b4605e1ce5..9d1dc5d6b67 100644 --- a/lld/lib/ReaderWriter/FileArchive.cpp +++ b/lld/lib/ReaderWriter/FileArchive.cpp @@ -219,7 +219,7 @@ private: bool _logLoading; std::vector<std::unique_ptr<MemoryBuffer>> _memberBuffers; std::mutex _mutex; - FileVector _filesReturned; + std::vector<std::unique_ptr<File>> _filesReturned; }; class ArchiveReader : public Reader { |

