aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-12-13 20:10:22 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-12-13 20:10:22 +0000
commite976df103e587c2c67c9ed84ca847a7a38a5d89d (patch)
tree022215cd48f11db5357090f60c67ab79981c7bdc
parent0684441d3bebd209a1229251ef61bc598e744813 (diff)
Object: Remove module accessors from IRObjectFile, and hide its constructor.
Differential Revision: https://reviews.llvm.org/D27079 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289577 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Object/IRObjectFile.h14
-rw-r--r--lib/Object/IRObjectFile.cpp9
2 files changed, 3 insertions, 20 deletions
diff --git a/include/llvm/Object/IRObjectFile.h b/include/llvm/Object/IRObjectFile.h
index 19c207ce6f6..744af7e9561 100644
--- a/include/llvm/Object/IRObjectFile.h
+++ b/include/llvm/Object/IRObjectFile.h
@@ -30,29 +30,17 @@ class ObjectFile;
class IRObjectFile : public SymbolicFile {
std::unique_ptr<Module> M;
ModuleSymbolTable SymTab;
+ IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> M);
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() 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) {
diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp
index 28c64b41940..07296e85e6c 100644
--- a/lib/Object/IRObjectFile.cpp
+++ b/lib/Object/IRObjectFile.cpp
@@ -60,12 +60,6 @@ uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
return SymTab.getSymbolFlags(getSym(Symb));
}
-GlobalValue *IRObjectFile::getSymbolGV(DataRefImpl Symb) {
- return getSym(Symb).dyn_cast<GlobalValue *>();
-}
-
-std::unique_ptr<Module> IRObjectFile::takeModule() { return std::move(M); }
-
basic_symbol_iterator IRObjectFile::symbol_begin() const {
DataRefImpl Ret;
Ret.p = reinterpret_cast<uintptr_t>(SymTab.symbols().data());
@@ -127,5 +121,6 @@ llvm::object::IRObjectFile::create(MemoryBufferRef Object,
return MOrErr.takeError();
std::unique_ptr<Module> &M = MOrErr.get();
- return llvm::make_unique<IRObjectFile>(BCOrErr.get(), std::move(M));
+ return std::unique_ptr<IRObjectFile>(
+ new IRObjectFile(*BCOrErr, std::move(M)));
}