[PATCH] D23218: [ADT] Change iterator_adaptor_base's default template arguments to forward more underlying typedefs

Tim Shen via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 5 11:28:43 PDT 2016


timshen created this revision.
timshen added reviewers: chandlerc, bkramer.
timshen added a subscriber: cfe-commits.

The corresponding LLVM change: D23217.

LazyVector::iterator breaks, because int isn't an iterator type.
Since iterator_adaptor_base shouldn't be blamed to break at the call to
iterator_traits<int>::xxx, I'd rather "fix" LazyVector::iterator.

The perfect solution is to model "relative pointer", but it's beyond the goal of this patch.

https://reviews.llvm.org/D23218

Files:
  include/clang/AST/ExternalASTSource.h

Index: include/clang/AST/ExternalASTSource.h
===================================================================
--- include/clang/AST/ExternalASTSource.h
+++ include/clang/AST/ExternalASTSource.h
@@ -503,8 +503,9 @@
   /// We define this as a wrapping iterator around an int. The
   /// iterator_adaptor_base class forwards the iterator methods to basic integer
   /// arithmetic.
-  class iterator : public llvm::iterator_adaptor_base<
-                       iterator, int, std::random_access_iterator_tag, T, int> {
+  class iterator
+      : public llvm::iterator_adaptor_base<
+            iterator, int, std::random_access_iterator_tag, T, int, T *, T &> {
     LazyVector *Self;
 
     iterator(LazyVector *Self, int Position)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23218.66984.patch
Type: text/x-patch
Size: 735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160805/2bacadfa/attachment.bin>


More information about the cfe-commits mailing list