[PATCH] D48144: [Support] Teach YAMLIO about polymorphic types

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 12:50:05 PDT 2018


scott.linder created this revision.
Herald added subscribers: llvm-commits, tpr.

Add support for "polymorphic" types to YAMLIO.

PolymorphicTraits can dynamically switch between other traits (Scalar, Map, or Sequence). When inputting, the PolymorphicTraits type is told which type to become, and when outputting the PolymorphicTraits type is asked which type it currently is.

Also adds support for TaggedScalarTraits to allow dynamically differentiating between multiple scalar types using YAML tags.

Some other minor changes, like serializing empty maps as "{}" and empty sequences as "[]", so that types are preserved when round-tripping PolymorphicTraits.

This patch is part of a series required for AMDGPU to support it's new MessagePack metadata.


Repository:
  rL LLVM

https://reviews.llvm.org/D48144

Files:
  include/llvm/Support/YAMLTraits.h
  lib/Support/YAMLTraits.cpp
  unittests/Support/YAMLIOTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48144.151231.patch
Type: text/x-patch
Size: 23202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180613/541091e9/attachment.bin>


More information about the llvm-commits mailing list