[PATCH] D27079: Object: Remove module accessors from IRObjectFile, and hide its constructor.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 16:11:45 PST 2016
pcc created this revision.
pcc added a reviewer: mehdi_amini.
pcc added subscribers: llvm-commits, rafael.
pcc added a dependency: D27078: LTO: Port the legacy LTO API to ModuleSymbolTable..
Depends on https://reviews.llvm.org/D27078
https://reviews.llvm.org/D27079
Files:
llvm/include/llvm/Object/IRObjectFile.h
llvm/lib/Object/IRObjectFile.cpp
Index: llvm/lib/Object/IRObjectFile.cpp
===================================================================
--- llvm/lib/Object/IRObjectFile.cpp
+++ llvm/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)));
}
Index: llvm/include/llvm/Object/IRObjectFile.h
===================================================================
--- llvm/include/llvm/Object/IRObjectFile.h
+++ llvm/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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27079.79171.patch
Type: text/x-patch
Size: 2167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161124/6e0e47ee/attachment.bin>
More information about the llvm-commits
mailing list