[PATCH] D27079: Object: Remove module accessors from IRObjectFile, and hide its constructor.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 12:20:47 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289577: Object: Remove module accessors from IRObjectFile, and hide its constructor. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D27079?vs=79171&id=81279#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27079

Files:
  llvm/trunk/include/llvm/Object/IRObjectFile.h
  llvm/trunk/lib/Object/IRObjectFile.cpp


Index: llvm/trunk/include/llvm/Object/IRObjectFile.h
===================================================================
--- llvm/trunk/include/llvm/Object/IRObjectFile.h
+++ llvm/trunk/include/llvm/Object/IRObjectFile.h
@@ -30,29 +30,17 @@
 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) {
Index: llvm/trunk/lib/Object/IRObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp
+++ llvm/trunk/lib/Object/IRObjectFile.cpp
@@ -60,12 +60,6 @@
   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 @@
     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)));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27079.81279.patch
Type: text/x-patch
Size: 2203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/5cf6fb77/attachment.bin>


More information about the llvm-commits mailing list