36 using namespace object;
39 std::vector<std::unique_ptr<Module>> Mods)
41 for (
auto &M : this->Mods)
42 SymTab.addModule(M.get());
58 return std::error_code();
67 Ret.
p =
reinterpret_cast<uintptr_t
>(SymTab.
symbols().data());
73 Ret.
p =
reinterpret_cast<uintptr_t
>(SymTab.
symbols().data() +
81 return Mods[0]->getTargetTriple();
86 if (Sec.isBitcode()) {
88 if (std::error_code EC = Sec.getContents(SecContents))
125 return BMsOrErr.takeError();
127 std::vector<std::unique_ptr<Module>> Mods;
128 for (
auto BM : *BMsOrErr) {
130 BM.getLazyModule(Context,
true,
135 Mods.push_back(std::move(*MOrErr));
138 return std::unique_ptr<IRObjectFile>(
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
std::error_code getError() const
Represents either an error or a value T.
This class is the base class for all object file types.
ELF Relocatable object file.
Error takeError()
Take ownership of the stored error.
static ModuleSymbolTable::Symbol getSym(DataRefImpl &Symb)
Expected< std::vector< BitcodeModule > > getBitcodeModuleList(MemoryBufferRef Buffer)
Returns a list of modules in the specified bitcode buffer.
Tagged union holding either a T or a Error.
basic_symbol_iterator symbol_begin() const override
static ErrorOr< MemoryBufferRef > findBitcodeInMemBuffer(MemoryBufferRef Object)
Finds and returns bitcode in the given memory buffer (which may be either a bitcode file or a native ...
std::error_code printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
static Expected< std::unique_ptr< IRObjectFile > > create(MemoryBufferRef Object, LLVMContext &Context)
basic_symbol_iterator symbol_end() const override
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
StringRef getTargetTriple() const
section_iterator_range sections() const
StringRef getFileName() const
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
content_iterator< BasicSymbolRef > basic_symbol_iterator
StringRef getBuffer() const
Module.h This file contains the declarations for the Module class.
reference get()
Returns a reference to the stored T value.
PointerUnion< GlobalValue *, AsmSymbol * > Symbol
uint32_t getSymbolFlags(Symbol S) const
void moveSymbolNext(DataRefImpl &Symb) const override
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
This is a value type class that represents a single symbol in the list of symbols in the object file...
ArrayRef< Symbol > symbols() const
void printSymbolName(raw_ostream &OS, Symbol S) const
static ErrorOr< MemoryBufferRef > findBitcodeInObject(const ObjectFile &Obj)
Finds and returns bitcode embedded in the given object file, or an error code if not found...
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
This is a value type class that represents a single section in the list of sections in the object fil...
uint32_t getSymbolFlags(DataRefImpl Symb) const override
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...