[llvm] r183539 - Make operator== non-member for greater symmetry.

Rafael Espindola rafael.espindola at gmail.com
Fri Jun 7 11:00:04 PDT 2013


Author: rafael
Date: Fri Jun  7 13:00:04 2013
New Revision: 183539

URL: http://llvm.org/viewvc/llvm-project?rev=183539&view=rev
Log:
Make operator== non-member for greater symmetry.

Thanks to David Blaikie for the suggestion.

Modified:
    llvm/trunk/include/llvm/Object/YAML.h

Modified: llvm/trunk/include/llvm/Object/YAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/YAML.h?rev=183539&r1=183538&r2=183539&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/YAML.h (original)
+++ llvm/trunk/include/llvm/Object/YAML.h Fri Jun  7 13:00:04 2013
@@ -62,6 +62,7 @@ namespace yaml {
 /// } // end namespace llvm
 /// \endcode
 class BinaryRef {
+  friend bool operator==(const BinaryRef &LHS, const BinaryRef &RHS);
   /// \brief Either raw binary data, or a string of hex bytes (must always
   /// be an even number of characters).
   ArrayRef<uint8_t> Data;
@@ -81,13 +82,6 @@ public:
       return Data.size() / 2;
     return Data.size();
   }
-  bool operator==(const BinaryRef &RHS) {
-    // Special case for default constructed BinaryRef.
-    if (RHS.Data.empty() && Data.empty())
-      return true;
-
-    return RHS.DataIsHexString == DataIsHexString && RHS.Data == Data;
-  }
   /// \brief Write the contents (regardless of whether it is binary or a
   /// hex string) as binary to the given raw_ostream.
   void writeAsBinary(raw_ostream &OS) const;
@@ -98,6 +92,14 @@ public:
   void writeAsHex(raw_ostream &OS) const;
 };
 
+inline bool operator==(const BinaryRef &LHS, const BinaryRef &RHS) {
+  // Special case for default constructed BinaryRef.
+  if (LHS.Data.empty() && RHS.Data.empty())
+    return true;
+
+  return LHS.DataIsHexString == RHS.DataIsHexString && LHS.Data == RHS.Data;
+}
+
 }
 }
 





More information about the llvm-commits mailing list