[YAML] Support serializing MutableArrayRef
authorChris Bieneman <chris.bieneman@me.com>
Tue, 20 Dec 2022 20:09:42 +0000 (14:09 -0600)
committerChris Bieneman <chris.bieneman@me.com>
Tue, 3 Jan 2023 18:29:11 +0000 (12:29 -0600)
commita95717ef71975dca4583944b3b8380284f346129
treefdec4d11b79ca6c5a49c7da8009b30212a720b98
parent750e1c8dbd935eab739544bcea86e2140f2b9109
[YAML] Support serializing MutableArrayRef

While the YAML format itself doesn't support fixed-sized arrays, some
of the data structures we encode in and out of YAML (specifically in
ObjectYAML) are actually fixed-sized arrays which we end up expressing
as resizable arrays.

Enabling the YAML tooling to support reading and writing from
fixed-sized arrays using MutableArrayRef can simplify some of the error
reporting and use logic for cases where the sizes of arrays are defined
by the target format.

Note: my SFINAE-foo isn't the best, so if there is a cleaner way to
implement the traits please advise.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D140427
llvm/include/llvm/Support/YAMLTraits.h
llvm/unittests/Support/YAMLIOTest.cpp