OSDN Git Service

NewSROA: Provide a full set of operator< for ByteRanges.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 17 Sep 2012 16:42:36 +0000 (16:42 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 17 Sep 2012 16:42:36 +0000 (16:42 +0000)
MSVC8 won't compile lower_bound if one is missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164035 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SROA.cpp

index daf99fb..a7d8ee7 100644 (file)
@@ -110,8 +110,13 @@ public:
     }
 
     /// \brief Support comparison with a single offset to allow binary searches.
-    bool operator<(uint64_t RHSOffset) const {
-      return BeginOffset < RHSOffset;
+    friend bool operator<(const ByteRange &LHS, uint64_t RHSOffset) {
+      return LHS.BeginOffset < RHSOffset;
+    }
+
+    friend LLVM_ATTRIBUTE_UNUSED bool operator<(uint64_t LHSOffset,
+                                                const ByteRange &RHS) {
+      return LHSOffset < RHS.BeginOffset;
     }
 
     bool operator==(const ByteRange &RHS) const {