From 814b52710ad53e6d613aebaca8df8e962a432f50 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 7 Jun 2013 18:00:04 +0000 Subject: Make operator== non-member for greater symmetry. Thanks to David Blaikie for the suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183539 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/YAML.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/llvm/Object/YAML.h b/include/llvm/Object/YAML.h index 89cbe42a5b..89fe5047a8 100644 --- a/include/llvm/Object/YAML.h +++ b/include/llvm/Object/YAML.h @@ -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 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; +} + } } -- cgit v1.2.3