20using namespace object;
28 std::vector<std::unique_ptr<Module>> Mods)
30 for (
auto &M : this->Mods)
31 SymTab.addModule(
M.get());
55 Ret.p =
reinterpret_cast<uintptr_t
>(SymTab.
symbols().data());
61 Ret.p =
reinterpret_cast<uintptr_t
>(SymTab.
symbols().data() +
69 return Mods[0]->getTargetTriple();
75 if (Sec.isBitcode()) {
79 if (Contents->size() <= 1)
120 std::vector<std::unique_ptr<Module>> Mods;
121 for (
auto BM : *BMsOrErr) {
123 BM.getLazyModule(Context,
true,
128 Mods.push_back(std::move(*MOrErr));
131 return std::unique_ptr<IRObjectFile>(
150 F.Mods = std::move(BFCOrErr->Mods);
151 F.Symtab = std::move(FCOrErr->Symtab);
152 F.Strtab = std::move(FCOrErr->Strtab);
153 F.TheReader = std::move(FCOrErr->TheReader);
static ModuleSymbolTable::Symbol getSym(DataRefImpl &Symb)
Module.h This file contains the declarations for the Module class.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
This is an important class for using LLVM in a threaded context.
void printSymbolName(raw_ostream &OS, Symbol S) const
PointerUnion< GlobalValue *, AsmSymbol * > Symbol
uint32_t getSymbolFlags(Symbol S) const
ArrayRef< Symbol > symbols() const
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
This is a value type class that represents a single symbol in the list of symbols in the object file.
StringRef getFileName() const
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
StringRef getTargetTriple() const
basic_symbol_iterator symbol_begin() const override
static Expected< MemoryBufferRef > findBitcodeInObject(const ObjectFile &Obj)
Finds and returns bitcode embedded in the given object file, or an error code if not found.
basic_symbol_iterator symbol_end() const override
void moveSymbolNext(DataRefImpl &Symb) const override
static Expected< MemoryBufferRef > findBitcodeInMemBuffer(MemoryBufferRef Object)
Finds and returns bitcode in the given memory buffer (which may be either a bitcode file or a native ...
static Expected< std::unique_ptr< IRObjectFile > > create(MemoryBufferRef Object, LLVMContext &Context)
This class is the base class for all object file types.
section_iterator_range sections() const
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
This is a value type class that represents a single section in the list of sections in the object fil...
This class implements an extremely fast bulk output stream that can only output to a stream.
Expected< FileContents > readBitcode(const BitcodeFileContents &BFC)
Reads the contents of a bitcode file, creating its irsymtab if necessary.
Expected< IRSymtabFile > readIRSymtab(MemoryBufferRef MBRef)
Reads a bitcode file, creating its irsymtab if necessary.
@ bitcode_section_not_found
content_iterator< BasicSymbolRef > basic_symbol_iterator
This is an optimization pass for GlobalISel generic memory operations.
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Expected< BitcodeFileContents > getBitcodeFileContents(MemoryBufferRef Buffer)
Returns the contents of a bitcode file.
Expected< std::vector< BitcodeModule > > getBitcodeModuleList(MemoryBufferRef Buffer)
Returns a list of modules in the specified bitcode buffer.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Implement std::hash so that hash_code can be used in STL containers.
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
@ elf_relocatable
ELF Relocatable object file.
@ wasm_object
WebAssembly Object file.
@ macho_object
Mach-O Object file.
@ coff_object
COFF object file.
The contents of a bitcode file and its irsymtab.