summaryrefslogtreecommitdiff
path: root/include/llvm/Object/ObjectFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/ObjectFile.h')
-rw-r--r--include/llvm/Object/ObjectFile.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index d16e4dda6c..eee9d447cd 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -14,13 +14,15 @@
#ifndef LLVM_OBJECT_OBJECT_FILE_H
#define LLVM_OBJECT_OBJECT_FILE_H
-#include "llvm/Object/Binary.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/MemoryBuffer.h"
#include <cstring>
namespace llvm {
+
+class MemoryBuffer;
+class StringRef;
+
namespace object {
class ObjectFile;
@@ -91,17 +93,16 @@ const uint64_t UnknownAddressOrSize = ~0ULL;
/// ObjectFile - This class is the base class for all object file types.
/// Concrete instances of this object are created by createObjectFile, which
/// figure out which type to create.
-class ObjectFile : public Binary {
+class ObjectFile {
private:
ObjectFile(); // = delete
ObjectFile(const ObjectFile &other); // = delete
protected:
- ObjectFile(unsigned int Type, MemoryBuffer *source, error_code &ec);
+ MemoryBuffer *MapFile;
+ const uint8_t *base;
- const uint8_t *base() const {
- return reinterpret_cast<const uint8_t *>(Data->getBufferStart());
- }
+ ObjectFile(MemoryBuffer *Object);
// These functions are for SymbolRef to call internally. The main goal of
// this is to allow SymbolRef::SymbolPimpl to point directly to the symbol
@@ -155,6 +156,8 @@ public:
typedef content_iterator<SymbolRef> symbol_iterator;
typedef content_iterator<SectionRef> section_iterator;
+ virtual ~ObjectFile();
+
virtual symbol_iterator begin_symbols() const = 0;
virtual symbol_iterator end_symbols() const = 0;
@@ -168,6 +171,8 @@ public:
virtual StringRef getFileFormatName() const = 0;
virtual /* Triple::ArchType */ unsigned getArch() const = 0;
+ StringRef getFilename() const;
+
/// @returns Pointer to ObjectFile subclass to handle this type of object.
/// @param ObjectPath The path to the object file. ObjectPath.isObject must
/// return true.
@@ -175,16 +180,12 @@ public:
static ObjectFile *createObjectFile(StringRef ObjectPath);
static ObjectFile *createObjectFile(MemoryBuffer *Object);
- static inline bool classof(const Binary *v) {
- return v->getType() >= isObject &&
- v->getType() < lastObject;
- }
- static inline bool classof(const ObjectFile *v) { return true; }
-
-public:
+private:
static ObjectFile *createCOFFObjectFile(MemoryBuffer *Object);
static ObjectFile *createELFObjectFile(MemoryBuffer *Object);
static ObjectFile *createMachOObjectFile(MemoryBuffer *Object);
+ static ObjectFile *createArchiveObjectFile(MemoryBuffer *Object);
+ static ObjectFile *createLibObjectFile(MemoryBuffer *Object);
};
// Inline function definitions.