#ifndef LLVM_OBJECT_MACHOUNIVERSAL_H
#define LLVM_OBJECT_MACHOUNIVERSAL_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Object/Binary.h"
+#include "llvm/Object/Archive.h"
+#include "llvm/Object/MachO.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MachO.h"
ObjectForArch(const MachOUniversalBinary *Parent, uint32_t Index);
void clear() {
- Parent = 0;
+ Parent = nullptr;
Index = 0;
}
ObjectForArch getNext() const { return ObjectForArch(Parent, Index + 1); }
uint32_t getCPUType() const { return Header.cputype; }
+ std::string getArchTypeName() const {
+ return Triple::getArchTypeName(MachOObjectFile::getArch(Header.cputype));
+ }
+
+ ErrorOr<std::unique_ptr<ObjectFile>> getAsObjectFile() const;
- error_code getAsObjectFile(OwningPtr<ObjectFile> &Result) const;
+ std::error_code getAsArchive(std::unique_ptr<Archive> &Result) const;
};
class object_iterator {
}
};
- MachOUniversalBinary(MemoryBuffer *Source, error_code &ec);
+ MachOUniversalBinary(MemoryBuffer *Source, std::error_code &ec);
static ErrorOr<MachOUniversalBinary*> create(MemoryBuffer *Source);
object_iterator begin_objects() const {
return ObjectForArch(this, 0);
}
object_iterator end_objects() const {
- return ObjectForArch(0, 0);
+ return ObjectForArch(nullptr, 0);
}
uint32_t getNumberOfObjects() const { return NumberOfObjects; }
return V->isMachOUniversalBinary();
}
- error_code getObjectForArch(Triple::ArchType Arch,
- OwningPtr<ObjectFile> &Result) const;
+ ErrorOr<std::unique_ptr<ObjectFile>>
+ getObjectForArch(Triple::ArchType Arch) const;
};
}