[llvm] r227018 - InstrProf: Add operator!= to coverage counters

Justin Bogner mail at justinbogner.com
Sat Jan 24 13:13:23 PST 2015


Author: bogner
Date: Sat Jan 24 15:13:23 2015
New Revision: 227018

URL: http://llvm.org/viewvc/llvm-project?rev=227018&view=rev
Log:
InstrProf: Add operator!= to coverage counters

I'll use this in clang shortly. Also makes the operator definition
style more consistent in this class.

Modified:
    llvm/trunk/include/llvm/ProfileData/CoverageMapping.h

Modified: llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMapping.h?rev=227018&r1=227017&r2=227018&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/CoverageMapping.h (original)
+++ llvm/trunk/include/llvm/ProfileData/CoverageMapping.h Sat Jan 24 15:13:23 2015
@@ -63,8 +63,12 @@ public:
 
   unsigned getExpressionID() const { return ID; }
 
-  bool operator==(const Counter &Other) const {
-    return Kind == Other.Kind && ID == Other.ID;
+  friend bool operator==(const Counter &LHS, const Counter &RHS) {
+    return LHS.Kind == RHS.Kind && LHS.ID == RHS.ID;
+  }
+
+  friend bool operator!=(const Counter &LHS, const Counter &RHS) {
+    return !(LHS == RHS);
   }
 
   friend bool operator<(const Counter &LHS, const Counter &RHS) {





More information about the llvm-commits mailing list