[libunwind] 2d865cc - unwind: EHABISectionIterator `operator!=`, constify `operator-`

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 08:54:55 PDT 2020


Author: Saleem Abdulrasool
Date: 2020-06-18T08:54:34-07:00
New Revision: 2d865ccbd8c47fe94af04a6cffd02c45a24e2ffb

URL: https://github.com/llvm/llvm-project/commit/2d865ccbd8c47fe94af04a6cffd02c45a24e2ffb
DIFF: https://github.com/llvm/llvm-project/commit/2d865ccbd8c47fe94af04a6cffd02c45a24e2ffb.diff

LOG: unwind: EHABISectionIterator `operator!=`, constify `operator-`

Add missing `operator!=` and make `operator-` const for
`EHABISectionIterator`.  This repairs the build of libunwind when
building with GCC.

Patch by Chad Duffin!

Reviewed By: compnerd, libunwind
Differential Revision: https://reviews.llvm.org/D81597

Added: 
    

Modified: 
    libunwind/src/UnwindCursor.hpp

Removed: 
    


################################################################################
diff  --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 8200eeee4eaa..f346c720d22c 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -1275,7 +1275,7 @@ struct EHABISectionIterator {
   _Self operator+(size_t a) { _Self out = *this; out._i += a; return out; }
   _Self operator-(size_t a) { assert(_i >= a); _Self out = *this; out._i -= a; return out; }
 
-  size_t operator-(const _Self& other) { return _i - other._i; }
+  size_t operator-(const _Self& other) const { return _i - other._i; }
 
   bool operator==(const _Self& other) const {
     assert(_addressSpace == other._addressSpace);
@@ -1283,6 +1283,12 @@ struct EHABISectionIterator {
     return _i == other._i;
   }
 
+  bool operator!=(const _Self& other) const {
+    assert(_addressSpace == other._addressSpace);
+    assert(_sects == other._sects);
+    return _i != other._i;
+  }
+
   typename A::pint_t operator*() const { return functionAddress(); }
 
   typename A::pint_t functionAddress() const {


        


More information about the cfe-commits mailing list