[PATCH] D32235: Add `operator->` overload to VarStreamArrayIterator

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 11:17:10 PDT 2017


amccarth created this revision.

Without this change you get type conversion errors if you use `MyIter->foo()` instead of `(*MyIter).foo()`, and the diagnostic messages were difficult to comprehend because of the layers of templates.


https://reviews.llvm.org/D32235

Files:
  llvm/include/llvm/Support/BinaryStreamArray.h


Index: llvm/include/llvm/Support/BinaryStreamArray.h
===================================================================
--- llvm/include/llvm/Support/BinaryStreamArray.h
+++ llvm/include/llvm/Support/BinaryStreamArray.h
@@ -162,6 +162,11 @@
     return ThisValue;
   }
 
+  const ValueType *operator->() const {
+    assert(Array && !HasError);
+    return &ThisValue;
+  }
+
   IterType &operator+=(unsigned N) {
     for (unsigned I = 0; I < N; ++I) {
       // We are done with the current record, discard it so that we are


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32235.95784.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/0f09c05b/attachment.bin>


More information about the llvm-commits mailing list