[PATCH] D19724: Add operator- to Path's reverse_iterator. Needed for D19666

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 08:32:13 PDT 2016


filcab created this revision.
filcab added reviewers: rafael, craig.topper, bogner.
filcab added a subscriber: llvm-commits.

http://reviews.llvm.org/D19724

Files:
  include/llvm/Support/Path.h
  lib/Support/Path.cpp

Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp
+++ lib/Support/Path.cpp
@@ -353,6 +353,10 @@
          Position == RHS.Position;
 }
 
+ptrdiff_t reverse_iterator::operator-(const reverse_iterator &RHS) const {
+  return Position - RHS.Position;
+}
+
 StringRef root_path(StringRef path) {
   const_iterator b = begin(path),
                  pos = b,
Index: include/llvm/Support/Path.h
===================================================================
--- include/llvm/Support/Path.h
+++ include/llvm/Support/Path.h
@@ -87,6 +87,9 @@
   reverse_iterator &operator++();    // preincrement
   bool operator==(const reverse_iterator &RHS) const;
   bool operator!=(const reverse_iterator &RHS) const { return !(*this == RHS); }
+
+  /// @brief Difference in bytes between this and RHS.
+  ptrdiff_t operator-(const reverse_iterator &RHS) const;
 };
 
 /// @brief Get begin iterator over \a path.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19724.55603.patch
Type: text/x-patch
Size: 969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/44ad7306/attachment.bin>


More information about the llvm-commits mailing list