/// Get the next file to be processed by the resolver
virtual ErrorOr<File &> getNextFile() = 0;
- /// \brief Reset the next index
- virtual void resetNextIndex() = 0;
-
/// Get the elements that we want to expand with.
virtual bool getReplacements(InputGraph::InputElementVectorT &) {
return false;
llvm_unreachable("shouldn't be here.");
}
- void resetNextIndex() override {}
-
private:
int _size;
};
_files.push_back(std::move(ai));
}
- /// \brief Reset the file index if the resolver needs to process
- /// the node again.
- void resetNextIndex() override { _nextFileIndex = 0; }
-
bool getReplacements(InputGraph::InputElementVectorT &result) override;
/// \brief Return the next File thats part of this node to the
/// \brief Parse the input file to lld::File.
std::error_code parse(const LinkingContext &, raw_ostream &) override;
- /// \brief This is used by Group Nodes, when there is a need to reset the
- /// the file to be processed next. When handling a group node that contains
- /// Input elements, if the group node has to be reprocessed, the linker needs
- /// to start processing files as part of the input element from beginning.
- /// Reset the next file index to 0 only if the node is an archive library.
- void resetNextIndex() override {
- auto kind = _files[0]->kind();
- if (kind == File::kindSharedLibrary ||
- (kind == File::kindArchiveLibrary && !_attributes._isWholeArchive)) {
- _nextFileIndex = 0;
- }
- }
-
private:
llvm::BumpPtrAllocator _alloc;
const ELFLinkingContext &_elfLinkingContext;
return true;
}
- // Linker Script will be expanded and replaced with other elements
- // by InputGraph::normalize(), so at link time it does not exist in
- // the tree. No need to handle this message.
- void resetNextIndex() override {}
-
private:
InputGraph::InputElementVectorT _expandElements;
};
bool validateImpl(raw_ostream &) override { return true; }
};
-class TestFileNode : public SimpleFileNode {
-public:
- TestFileNode(StringRef path) : SimpleFileNode(path) {}
- void resetNextIndex() override { FileNode::resetNextIndex(); }
-};
-
class TestExpandFileNode : public SimpleFileNode {
public:
TestExpandFileNode(StringRef path) : SimpleFileNode(path) {}
} // end anonymous namespace
-static std::unique_ptr<TestFileNode> createFile(StringRef name) {
+static std::unique_ptr<SimpleFileNode> createFile(StringRef name) {
std::vector<std::unique_ptr<File>> files;
files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name)));
- std::unique_ptr<TestFileNode> file(new TestFileNode("filenode"));
+ std::unique_ptr<SimpleFileNode> file(new SimpleFileNode("filenode"));
file->addFiles(std::move(files));
return file;
}