29 std::vector<std::unique_ptr<Module>> Mods)
30 : SymbolicFile(
Binary::ID_IR, Object), Mods(
std::move(Mods)) {
31 for (
auto &M : this->Mods)
32 SymTab.addModule(
M.get());
35 IRObjectFile::~IRObjectFile() {}
46 SymTab.printSymbolName(OS,
getSym(Symb));
51 return SymTab.getSymbolFlags(
getSym(Symb));
56 Ret.
p =
reinterpret_cast<uintptr_t
>(SymTab.symbols().data());
62 Ret.
p =
reinterpret_cast<uintptr_t
>(SymTab.symbols().data() +
63 SymTab.symbols().size());
70 return Mods[0]->getTargetTriple();
74 IRObjectFile::findBitcodeInObject(
const ObjectFile &Obj) {
76 if (Sec.isBitcode()) {
80 if (Contents->size() <= 1)
95 case file_magic::elf_relocatable:
96 case file_magic::macho_object:
97 case file_magic::coff_object: {
99 ObjectFile::createObjectFile(Object, Type);
102 return findBitcodeInObject(*ObjFile->
get());
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>(
138 IRObjectFile::findBitcodeInMemBuffer(MBRef);
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);
This class represents lattice values for constants.
StringRef getFileName() const
This class is the base class for all object file types.
irsymtab::Reader TheReader
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.
StringRef getBuffer() const
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Tagged union holding either a T or a Error.
The contents of a bitcode file and its irsymtab.
section_iterator_range sections() const
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.
std::vector< BitcodeModule > Mods
Expected< BitcodeFileContents > getBitcodeFileContents(MemoryBufferRef Buffer)
Returns the contents of a bitcode file.
Module.h This file contains the declarations for the Module class.
SmallVector< char, 0 > Strtab
reference get()
Returns a reference to the stored T value.
Expected< FileContents > readBitcode(const BitcodeFileContents &BFC)
Reads the contents of a bitcode file, creating its irsymtab if necessary.
content_iterator< BasicSymbolRef > basic_symbol_iterator
success
Parameters (see the expansion example below): (the builder, addr, loaded, new_val, ordering, /* OUT.
This is a value type class that represents a single symbol in the list of symbols in the object file...
Lightweight error class with error context and mandatory checking.
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.
Expected< IRSymtabFile > readIRSymtab(MemoryBufferRef MBRef)
Reads a bitcode file, creating its irsymtab if necessary.
SmallVector< char, 0 > Symtab
This is a value type class that represents a single section in the list of sections in the object fil...
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...