diff options
Diffstat (limited to 'include/llvm/Object/IRObjectFile.h')
-rw-r--r-- | include/llvm/Object/IRObjectFile.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/llvm/Object/IRObjectFile.h b/include/llvm/Object/IRObjectFile.h index 6c271b1a1f44..993359b766a1 100644 --- a/include/llvm/Object/IRObjectFile.h +++ b/include/llvm/Object/IRObjectFile.h @@ -50,11 +50,22 @@ public: return v->isIR(); } - /// \brief Finds and returns bitcode embedded in the given object file, or an + using module_iterator = + pointee_iterator<std::vector<std::unique_ptr<Module>>::const_iterator, + const Module>; + + module_iterator module_begin() const { return module_iterator(Mods.begin()); } + module_iterator module_end() const { return module_iterator(Mods.end()); } + + iterator_range<module_iterator> modules() const { + return make_range(module_begin(), module_end()); + } + + /// Finds and returns bitcode embedded in the given object file, or an /// error code if not found. static Expected<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj); - /// \brief Finds and returns bitcode in the given memory buffer (which may + /// 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 Expected<MemoryBufferRef> |