X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FObject%2FBinary.h;h=a0d1127781f64bc963865237650bfebf02cc4ae9;hb=5862853db7ee22e6244f1736963c98fba47bd0dc;hp=23c66eae2056324bdbade3dda7fde79e07c31f1b;hpb=6825609779f185f5f81a797ad62c2779f277a9ad;p=oota-llvm.git diff --git a/include/llvm/Object/Binary.h b/include/llvm/Object/Binary.h index 23c66eae205..a0d1127781f 100644 --- a/include/llvm/Object/Binary.h +++ b/include/llvm/Object/Binary.h @@ -28,8 +28,8 @@ namespace object { class Binary { private: - Binary() LLVM_DELETED_FUNCTION; - Binary(const Binary &other) LLVM_DELETED_FUNCTION; + Binary() = delete; + Binary(const Binary &other) = delete; unsigned int TypeID; @@ -41,7 +41,9 @@ protected: enum { ID_Archive, ID_MachOUniversalBinary, - ID_IR, // LLVM IR + ID_COFFImportFile, + ID_IR, // LLVM IR + ID_FunctionIndex, // Function summary index // Object and children. ID_StartObjects, @@ -113,10 +115,16 @@ public: return TypeID == ID_COFF; } + bool isCOFFImportFile() const { + return TypeID == ID_COFFImportFile; + } + bool isIR() const { return TypeID == ID_IR; } + bool isFunctionIndex() const { return TypeID == ID_FunctionIndex; } + bool isLittleEndian() const { return !(TypeID == ID_ELF32B || TypeID == ID_ELF64B || TypeID == ID_MachO32B || TypeID == ID_MachO64B); @@ -139,8 +147,10 @@ public: OwningBinary(OwningBinary&& Other); OwningBinary &operator=(OwningBinary &&Other); - std::unique_ptr &getBinary(); - std::unique_ptr &getBuffer(); + std::pair, std::unique_ptr> takeBinary(); + + T* getBinary(); + const T* getBinary() const; }; template @@ -161,13 +171,18 @@ OwningBinary &OwningBinary::operator=(OwningBinary &&Other) { return *this; } -template std::unique_ptr &OwningBinary::getBinary() { - return Bin; +template +std::pair, std::unique_ptr> +OwningBinary::takeBinary() { + return std::make_pair(std::move(Bin), std::move(Buf)); } -template -std::unique_ptr &OwningBinary::getBuffer() { - return Buf; +template T* OwningBinary::getBinary() { + return Bin.get(); +} + +template const T* OwningBinary::getBinary() const { + return Bin.get(); } ErrorOr> createBinary(StringRef Path);