[lld] r224235 - Protect doParse() because that's not a public interface.
Rui Ueyama
ruiu at google.com
Sun Dec 14 23:14:33 PST 2014
Author: ruiu
Date: Mon Dec 15 01:14:32 2014
New Revision: 224235
URL: http://llvm.org/viewvc/llvm-project?rev=224235&view=rev
Log:
Protect doParse() because that's not a public interface.
Modified:
lld/trunk/include/lld/Core/File.h
lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
lld/trunk/lib/ReaderWriter/FileArchive.cpp
lld/trunk/lib/ReaderWriter/MachO/File.h
Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Mon Dec 15 01:14:32 2014
@@ -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>
Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Mon Dec 15 01:14:32 2014
@@ -55,6 +55,7 @@ public:
*this, name, _soname, sym->second._symbol);
}
+protected:
std::error_code doParse() override {
std::error_code ec;
_objFile.reset(
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Mon Dec 15 01:14:32 2014
@@ -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,
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Mon Dec 15 01:14:32 2014
@@ -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;
Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Mon Dec 15 01:14:32 2014
@@ -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,
Modified: lld/trunk/lib/ReaderWriter/MachO/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/File.h?rev=224235&r1=224234&r2=224235&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/File.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/File.h Mon Dec 15 01:14:32 2014
@@ -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());
More information about the llvm-commits
mailing list