[llvm] r289577 - Object: Remove module accessors from IRObjectFile, and hide its constructor.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 12:10:23 PST 2016
Author: pcc
Date: Tue Dec 13 14:10:22 2016
New Revision: 289577
URL: http://llvm.org/viewvc/llvm-project?rev=289577&view=rev
Log:
Object: Remove module accessors from IRObjectFile, and hide its constructor.
Differential Revision: https://reviews.llvm.org/D27079
Modified:
llvm/trunk/include/llvm/Object/IRObjectFile.h
llvm/trunk/lib/Object/IRObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/IRObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/IRObjectFile.h?rev=289577&r1=289576&r2=289577&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/IRObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/IRObjectFile.h Tue Dec 13 14:10:22 2016
@@ -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) {
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=289577&r1=289576&r2=289577&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Tue Dec 13 14:10:22 2016
@@ -60,12 +60,6 @@ uint32_t IRObjectFile::getSymbolFlags(Da
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(Memor
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)));
}
More information about the llvm-commits
mailing list