[llvm] r314822 - Implement David Blaikie's suggestion for comparison operators

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 11:30:11 PDT 2017


Author: rnk
Date: Tue Oct  3 11:30:11 2017
New Revision: 314822

URL: http://llvm.org/viewvc/llvm-project?rev=314822&view=rev
Log:
Implement David Blaikie's suggestion for comparison operators

Modified:
    llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp

Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=314822&r1=314821&r2=314822&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Tue Oct  3 11:30:11 2017
@@ -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;




More information about the llvm-commits mailing list