summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-07 18:00:04 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-07 18:00:04 +0000
commit814b52710ad53e6d613aebaca8df8e962a432f50 (patch)
tree3aa06506500d9d10fd4887e570f848bd4e24adb8 /include
parent6ca5fd3f30081853cfcf7f83a310f94aac2c5e17 (diff)
downloadllvm-814b52710ad53e6d613aebaca8df8e962a432f50.tar.gz
llvm-814b52710ad53e6d613aebaca8df8e962a432f50.tar.bz2
llvm-814b52710ad53e6d613aebaca8df8e962a432f50.tar.xz
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.h16
1 files changed, 9 insertions, 7 deletions
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<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;
+}
+
}
}