[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 09:53:57 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL268062: Add operator- to Path's reverse_iterator. Needed for D19666 (authored by filcab).

Changed prior to commit:
  http://reviews.llvm.org/D19724?vs=55603&id=55616#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19724

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

Index: llvm/trunk/include/llvm/Support/Path.h
===================================================================
--- llvm/trunk/include/llvm/Support/Path.h
+++ llvm/trunk/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.
Index: llvm/trunk/lib/Support/Path.cpp
===================================================================
--- llvm/trunk/lib/Support/Path.cpp
+++ llvm/trunk/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,


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


More information about the llvm-commits mailing list