diff options
author | Stephen Hines <srhines@google.com> | 2014-12-04 19:51:48 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-04 19:51:48 +0000 |
commit | a21bbdfad461e957fa42ac9d6860ddc9de2da3e9 (patch) | |
tree | 8d32ff2094b47e15a8def30d62fd7dee6e009de3 /include/llvm/Object/Archive.h | |
parent | 6b8c6a5088c221af2b25065b8b6b8b0fec8a116f (diff) | |
parent | 876d6995443e99d13696f3941c3a789a4daa7c7a (diff) | |
download | external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.zip external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.gz external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.bz2 |
am 876d6995: Merge "Update aosp/master LLVM for rebase to r222494."
* commit '876d6995443e99d13696f3941c3a789a4daa7c7a':
Update aosp/master LLVM for rebase to r222494.
Diffstat (limited to 'include/llvm/Object/Archive.h')
-rw-r--r-- | include/llvm/Object/Archive.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/include/llvm/Object/Archive.h b/include/llvm/Object/Archive.h index af6c995..7c03dcd 100644 --- a/include/llvm/Object/Archive.h +++ b/include/llvm/Object/Archive.h @@ -14,6 +14,7 @@ #ifndef LLVM_OBJECT_ARCHIVE_H #define LLVM_OBJECT_ARCHIVE_H +#include "llvm/ADT/iterator_range.h" #include "llvm/ADT/StringRef.h" #include "llvm/Object/Binary.h" #include "llvm/Support/ErrorHandling.h" @@ -89,8 +90,7 @@ public: return StringRef(Data.data() + StartOfFile, getSize()); } - ErrorOr<std::unique_ptr<MemoryBuffer>> - getMemoryBuffer(bool FullPath = false) const; + ErrorOr<MemoryBufferRef> getMemoryBufferRef() const; ErrorOr<std::unique_ptr<Binary>> getAsBinary(LLVMContext *Context = nullptr) const; @@ -98,12 +98,12 @@ public: class child_iterator { Child child; + public: child_iterator() : child(Child(nullptr, nullptr)) {} child_iterator(const Child &c) : child(c) {} - const Child* operator->() const { - return &child; - } + const Child *operator->() const { return &child; } + const Child &operator*() const { return child; } bool operator==(const child_iterator &other) const { return child == other.child; @@ -113,11 +113,11 @@ public: return !(*this == other); } - bool operator <(const child_iterator &other) const { + bool operator<(const child_iterator &other) const { return child < other.child; } - child_iterator& operator++() { // Preincrement + child_iterator &operator++() { // Preincrement child = child.getNext(); return *this; } @@ -164,8 +164,8 @@ public: } }; - Archive(std::unique_ptr<MemoryBuffer> Source, std::error_code &EC); - static ErrorOr<Archive *> create(std::unique_ptr<MemoryBuffer> Source); + Archive(MemoryBufferRef Source, std::error_code &EC); + static ErrorOr<std::unique_ptr<Archive>> create(MemoryBufferRef Source); enum Kind { K_GNU, @@ -179,6 +179,10 @@ public: child_iterator child_begin(bool SkipInternal = true) const; child_iterator child_end() const; + iterator_range<child_iterator> children(bool SkipInternal = true) const { + return iterator_range<child_iterator>(child_begin(SkipInternal), + child_end()); + } symbol_iterator symbol_begin() const; symbol_iterator symbol_end() const; |