makeErrorFile and parseMemberFiles are now used only in DarwinLdDriver.cpp.
This patch moves them to that file.
llvm-svn: 262423
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:
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) {
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()) {
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 {