[PATCH] D81250: [MsgPack] Added a convenience operator
Saiyedul Islam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 06:02:08 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf1b2be416dc5: [MsgPack] Added a convenience operator (authored by dineshkb-amd, committed by saiislam).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81250/new/
https://reviews.llvm.org/D81250
Files:
llvm/include/llvm/BinaryFormat/MsgPackDocument.h
llvm/unittests/BinaryFormat/MsgPackDocumentTest.cpp
Index: llvm/unittests/BinaryFormat/MsgPackDocumentTest.cpp
===================================================================
--- llvm/unittests/BinaryFormat/MsgPackDocumentTest.cpp
+++ llvm/unittests/BinaryFormat/MsgPackDocumentTest.cpp
@@ -13,6 +13,16 @@
using namespace llvm;
using namespace msgpack;
+TEST(MsgPackDocument, DocNodeTest) {
+ Document Doc;
+
+ DocNode Int1 = Doc.getNode(1), Int2 = Doc.getNode(2);
+ DocNode Str1 = Doc.getNode("ab"), Str2 = Doc.getNode("ab");
+
+ ASSERT_TRUE(Int1 != Int2);
+ ASSERT_TRUE(Str1 == Str2);
+}
+
TEST(MsgPackDocument, TestReadInt) {
Document Doc;
bool Ok = Doc.readFromBlob(StringRef("\xd0\x00", 2), /*Multi=*/false);
Index: llvm/include/llvm/BinaryFormat/MsgPackDocument.h
===================================================================
--- llvm/include/llvm/BinaryFormat/MsgPackDocument.h
+++ llvm/include/llvm/BinaryFormat/MsgPackDocument.h
@@ -181,6 +181,11 @@
return !(Lhs < Rhs) && !(Rhs < Lhs);
}
+ /// Inequality operator
+ friend bool operator!=(const DocNode &Lhs, const DocNode &Rhs) {
+ return !(Lhs == Rhs);
+ }
+
/// Convert this node to a string, assuming it is scalar.
std::string toString() const;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81250.268763.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/b2b42aed/attachment.bin>
More information about the llvm-commits
mailing list