Make Binary the parent of ObjectFile and update children to new interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer
2011-06-25 17:54:50 +00:00
parent c44c915372
commit 001c9205fc
9 changed files with 222 additions and 170 deletions

View File

@ -32,8 +32,8 @@ typedef MachOObject::LoadCommandInfo LoadCommandInfo;
class MachOObjectFile : public ObjectFile {
public:
MachOObjectFile(MemoryBuffer *Object, MachOObject *MOO)
: ObjectFile(Object),
MachOObjectFile(MemoryBuffer *Object, MachOObject *MOO, error_code &ec)
: ObjectFile(Binary::isMachO, Object, ec),
MachOObj(MOO),
RegisteredStringTable(std::numeric_limits<uint32_t>::max()) {}
@ -73,11 +73,12 @@ private:
};
ObjectFile *ObjectFile::createMachOObjectFile(MemoryBuffer *Buffer) {
error_code ec;
std::string Err;
MachOObject *MachOObj = MachOObject::LoadFromBuffer(Buffer, &Err);
if (!MachOObj)
return NULL;
return new MachOObjectFile(Buffer, MachOObj);
return new MachOObjectFile(Buffer, MachOObj, ec);
}
/*===-- Symbols -----------------------------------------------------------===*/