/// all AbsoluteAtoms in this File.
virtual const atom_collection<AbsoluteAtom> &absolute() const = 0;
- /// \brief Subclasses should override this method to parse the
- /// memory buffer passed to this file's constructor.
- virtual std::error_code doParse() { return std::error_code(); }
-
/// \brief If a file is parsed using a different method than doParse(),
/// one must use this method to set the last error status, so that
/// doParse will not be called twice. Only YAML reader uses this
File(StringRef p, Kind kind)
: _path(p), _kind(kind), _ordinal(UINT64_MAX) {}
+ /// \brief Subclasses should override this method to parse the
+ /// memory buffer passed to this file's constructor.
+ virtual std::error_code doParse() { return std::error_code(); }
+
/// \brief This is a convenience class for File subclasses which manage their
/// atoms as a simple std::vector<>.
template <typename T>
*this, name, _soname, sym->second._symbol);
}
+protected:
std::error_code doParse() override {
std::error_code ec;
_objFile.reset(
: File(mb->getBufferIdentifier(), kindObject), _mb(std::move(mb)),
_ordinal(0), _doStringsMerge(atomizeStrings) {}
- virtual std::error_code doParse() override;
-
static ErrorOr<std::unique_ptr<ELFFile>>
create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings);
const Elf_Shdr *section, ArrayRef<uint8_t> symContent,
ArrayRef<uint8_t> secContent);
+ std::error_code doParse() override;
+
/// \brief Iterate over Elf_Rela relocations list and create references.
virtual void createRelocationReferences(const Elf_Sym &symbol,
ArrayRef<uint8_t> content,
uint64_t getTPOffset() const { return *_tpOff; }
uint64_t getDTPOffset() const { return *_dtpOff; }
+protected:
std::error_code doParse() override {
if (std::error_code ec = ELFFile<ELFT>::doParse())
return ec;
: ArchiveLibraryFile(path), _mb(std::shared_ptr<MemoryBuffer>(mb.release())),
_registry(reg), _logLoading(logLoading) {}
- std::error_code doParse() override {
- // Make Archive object which will be owned by FileArchive object.
- std::error_code ec;
- _archive.reset(new Archive(_mb->getMemBufferRef(), ec));
- if (ec)
- return ec;
- if ((ec = buildTableOfContents()))
- return ec;
- return std::error_code();
- }
-
virtual ~FileArchive() {}
/// \brief Check if any member of the archive contains an Atom with the
return ret;
}
+protected:
+ std::error_code doParse() override {
+ // Make Archive object which will be owned by FileArchive object.
+ std::error_code ec;
+ _archive.reset(new Archive(_mb->getMemBufferRef(), ec));
+ if (ec)
+ return ec;
+ if ((ec = buildTableOfContents()))
+ return ec;
+ return std::error_code();
+ }
+
private:
std::error_code
instantiateMember(Archive::child_iterator member,
visitor(offAndAtom.atom, offAndAtom.offset);
}
+protected:
std::error_code doParse() override {
// Convert binary file to normalized mach-o.
auto normFile = normalized::readBinary(_mb, _ctx->arch());