diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-07 18:00:04 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-07 18:00:04 +0000 |
commit | 814b52710ad53e6d613aebaca8df8e962a432f50 (patch) | |
tree | 3aa06506500d9d10fd4887e570f848bd4e24adb8 /include | |
parent | 6ca5fd3f30081853cfcf7f83a310f94aac2c5e17 (diff) | |
download | external_llvm-814b52710ad53e6d613aebaca8df8e962a432f50.zip external_llvm-814b52710ad53e6d613aebaca8df8e962a432f50.tar.gz external_llvm-814b52710ad53e6d613aebaca8df8e962a432f50.tar.bz2 |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Object/YAML.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/llvm/Object/YAML.h b/include/llvm/Object/YAML.h index 89cbe42..89fe504 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<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; +} + } } |