diff options
| author | Rui Ueyama <ruiu@google.com> | 2014-12-15 07:14:32 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2014-12-15 07:14:32 +0000 |
| commit | 0a2c2dbfc2e023b1ae5ff06a99c6b31c7fc36363 (patch) | |
| tree | 9abc7c5fbda6a3983714053655ff89183a392adb | |
| parent | 51eb1308bd413ce4b53439f79091a45a1b1e1e50 (diff) | |
| download | bcm5719-llvm-0a2c2dbfc2e023b1ae5ff06a99c6b31c7fc36363.tar.gz bcm5719-llvm-0a2c2dbfc2e023b1ae5ff06a99c6b31c7fc36363.zip | |
Protect doParse() because that's not a public interface.
llvm-svn: 224235
| -rw-r--r-- | lld/include/lld/Core/File.h | 8 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/DynamicFile.h | 1 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFFile.h | 4 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 1 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/FileArchive.cpp | 23 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/File.h | 1 |
6 files changed, 21 insertions, 17 deletions
diff --git a/lld/include/lld/Core/File.h b/lld/include/lld/Core/File.h index 04be2465cea..1edf943c258 100644 --- a/lld/include/lld/Core/File.h +++ b/lld/include/lld/Core/File.h @@ -154,10 +154,6 @@ public: /// 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 @@ -184,6 +180,10 @@ protected: 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> diff --git a/lld/lib/ReaderWriter/ELF/DynamicFile.h b/lld/lib/ReaderWriter/ELF/DynamicFile.h index 73211c7d308..64139f52a1c 100644 --- a/lld/lib/ReaderWriter/ELF/DynamicFile.h +++ b/lld/lib/ReaderWriter/ELF/DynamicFile.h @@ -55,6 +55,7 @@ public: *this, name, _soname, sym->second._symbol); } +protected: std::error_code doParse() override { std::error_code ec; _objFile.reset( diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h index 8ca4c2de7f1..baab0d3a5ba 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.h +++ b/lld/lib/ReaderWriter/ELF/ELFFile.h @@ -122,8 +122,6 @@ public: : 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); @@ -171,6 +169,8 @@ protected: 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, diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index dd874f755fc..3bae86ed3ff 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -100,6 +100,7 @@ public: 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; diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp index 3f86682871a..ccb156e20e6 100644 --- a/lld/lib/ReaderWriter/FileArchive.cpp +++ b/lld/lib/ReaderWriter/FileArchive.cpp @@ -39,17 +39,6 @@ public: : 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 @@ -136,6 +125,18 @@ public: 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, diff --git a/lld/lib/ReaderWriter/MachO/File.h b/lld/lib/ReaderWriter/MachO/File.h index fdb7d3ba2f4..ae0fbfbf34e 100644 --- a/lld/lib/ReaderWriter/MachO/File.h +++ b/lld/lib/ReaderWriter/MachO/File.h @@ -175,6 +175,7 @@ public: 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()); |

