[llvm] r231203 - Object: Add range iterators to Archive symbols

Rui Ueyama ruiu at google.com
Tue Mar 3 18:05:06 PST 2015


Author: ruiu
Date: Tue Mar  3 20:05:06 2015
New Revision: 231203

URL: http://llvm.org/viewvc/llvm-project?rev=231203&view=rev
Log:
Object: Add range iterators to Archive symbols

Also define operator* for symbol iterator just like Archive children iterator.


Modified:
    llvm/trunk/include/llvm/Object/Archive.h

Modified: llvm/trunk/include/llvm/Object/Archive.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Archive.h?rev=231203&r1=231202&r2=231203&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/Archive.h (original)
+++ llvm/trunk/include/llvm/Object/Archive.h Tue Mar  3 20:05:06 2015
@@ -155,9 +155,8 @@ public:
     Symbol symbol;
   public:
     symbol_iterator(const Symbol &s) : symbol(s) {}
-    const Symbol *operator->() const {
-      return &symbol;
-    }
+    const Symbol *operator->() const { return &symbol; }
+    const Symbol &operator*() const { return symbol; }
 
     bool operator==(const symbol_iterator &other) const {
       return symbol == other.symbol;
@@ -194,6 +193,9 @@ public:
 
   symbol_iterator symbol_begin() const;
   symbol_iterator symbol_end() const;
+  iterator_range<symbol_iterator> symbols() const {
+    return iterator_range<symbol_iterator>(symbol_begin(), symbol_end());
+  }
 
   // Cast methods.
   static inline bool classof(Binary const *v) {





More information about the llvm-commits mailing list