OSDN Git Service

Implement David Blaikie's suggestion for comparison operators
authorReid Kleckner <rnk@google.com>
Tue, 3 Oct 2017 18:30:11 +0000 (18:30 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 3 Oct 2017 18:30:11 +0000 (18:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveDebugVariables.cpp

index 7a4694f..554a751 100644 (file)
@@ -116,10 +116,15 @@ public:
     return DbgValueLocation(NewLocNo, WasIndirect);
   }
 
-  bool operator==(const DbgValueLocation &O) const {
-    return LocNo == O.LocNo && WasIndirect == O.WasIndirect;
+  friend inline bool operator==(const DbgValueLocation &LHS,
+                                const DbgValueLocation &RHS) {
+    return LHS.LocNo == RHS.LocNo && LHS.WasIndirect == RHS.WasIndirect;
+  }
+
+  friend inline bool operator!=(const DbgValueLocation &LHS,
+                                const DbgValueLocation &RHS) {
+    return !(LHS == RHS);
   }
-  bool operator!=(const DbgValueLocation &O) const { return !(*this == O); }
 
 private:
   unsigned LocNo : 31;