summaryrefslogtreecommitdiff
path: root/include/llvm/Object/IRObjectFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/IRObjectFile.h')
-rw-r--r--include/llvm/Object/IRObjectFile.h39
1 files changed, 11 insertions, 28 deletions
diff --git a/include/llvm/Object/IRObjectFile.h b/include/llvm/Object/IRObjectFile.h
index 9fe011e17d62..0ea89011e883 100644
--- a/include/llvm/Object/IRObjectFile.h
+++ b/include/llvm/Object/IRObjectFile.h
@@ -14,6 +14,8 @@
#ifndef LLVM_OBJECT_IROBJECTFILE_H
#define LLVM_OBJECT_IROBJECTFILE_H
+#include "llvm/ADT/PointerUnion.h"
+#include "llvm/Object/ModuleSymbolTable.h"
#include "llvm/Object/SymbolicFile.h"
namespace llvm {
@@ -26,31 +28,21 @@ namespace object {
class ObjectFile;
class IRObjectFile : public SymbolicFile {
- std::unique_ptr<Module> M;
- std::unique_ptr<Mangler> Mang;
- std::vector<std::pair<std::string, uint32_t>> AsmSymbols;
+ std::vector<std::unique_ptr<Module>> Mods;
+ ModuleSymbolTable SymTab;
+ IRObjectFile(MemoryBufferRef Object,
+ std::vector<std::unique_ptr<Module>> Mods);
public:
- IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> M);
~IRObjectFile() override;
void moveSymbolNext(DataRefImpl &Symb) const override;
std::error_code printSymbolName(raw_ostream &OS,
DataRefImpl Symb) const override;
uint32_t getSymbolFlags(DataRefImpl Symb) const override;
- GlobalValue *getSymbolGV(DataRefImpl Symb);
- const GlobalValue *getSymbolGV(DataRefImpl Symb) const {
- return const_cast<IRObjectFile *>(this)->getSymbolGV(Symb);
- }
- basic_symbol_iterator symbol_begin_impl() const override;
- basic_symbol_iterator symbol_end_impl() const override;
+ basic_symbol_iterator symbol_begin() const override;
+ basic_symbol_iterator symbol_end() const override;
- const Module &getModule() const {
- return const_cast<IRObjectFile*>(this)->getModule();
- }
- Module &getModule() {
- return *M;
- }
- std::unique_ptr<Module> takeModule();
+ StringRef getTargetTriple() const;
static inline bool classof(const Binary *v) {
return v->isIR();
@@ -60,23 +52,14 @@ public:
/// error code if not found.
static ErrorOr<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj);
- /// Parse inline ASM and collect the symbols that are not defined in
- /// the current module.
- ///
- /// For each found symbol, call \p AsmUndefinedRefs with the name of the
- /// symbol found and the associated flags.
- static void CollectAsmUndefinedRefs(
- const Triple &TheTriple, StringRef InlineAsm,
- function_ref<void(StringRef, BasicSymbolRef::Flags)> AsmUndefinedRefs);
-
/// \brief Finds and returns bitcode in the given memory buffer (which may
/// be either a bitcode file or a native object file with embedded bitcode),
/// or an error code if not found.
static ErrorOr<MemoryBufferRef>
findBitcodeInMemBuffer(MemoryBufferRef Object);
- static ErrorOr<std::unique_ptr<IRObjectFile>> create(MemoryBufferRef Object,
- LLVMContext &Context);
+ static Expected<std::unique_ptr<IRObjectFile>> create(MemoryBufferRef Object,
+ LLVMContext &Context);
};
}
}