[PATCH] D80121: [MsgPack] Added convenience assignment to MsgPackDocument

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 06:57:15 PDT 2020


tpr created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
tpr updated this revision to Diff 264610.
tpr added a comment.

V2: Added tests


This commit increases the convenience of using the MsgPackDocument API,
especially when creating a document for writing out.

It adds direct assignment of bool, integer and string types to a
DocNode, as long as that DocNode is already inside a document, e.g. the
result of a map lookup. It also adds map lookup given an integer type
(it already had that for string).

So, to assign a string to a map element whose key is an int, you can
now write

  MyMap[42] = "towel";

instead of

  MyMap[MyMap.getDocument()->getNode(42)] =
      MyMap.getDocument()->getNode("towel");

Change-Id: I17301fa15bb9802231c52542798af5b54beb583e


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80121

Files:
  llvm/include/llvm/BinaryFormat/MsgPackDocument.h
  llvm/lib/BinaryFormat/MsgPackDocument.cpp
  llvm/unittests/BinaryFormat/MsgPackDocumentTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80121.264610.patch
Type: text/x-patch
Size: 5171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/ccbf1cd6/attachment.bin>


More information about the llvm-commits mailing list