This is an archive of the discontinued LLVM Phabricator instance.

[YAML] Support serializing MutableArrayRef
ClosedPublic

Authored by beanz on Dec 20 2022, 12:12 PM.

Details

Summary

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.

Diff Detail

Event Timeline

beanz created this revision.Dec 20 2022, 12:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 12:12 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
beanz requested review of this revision.Dec 20 2022, 12:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 12:12 PM
MaskRay accepted this revision.Dec 20 2022, 1:11 PM
MaskRay added inline comments.
llvm/include/llvm/Support/YAMLTraits.h
1982

delete private and public

llvm/unittests/Support/YAMLIOTest.cpp
3273

It seems that this file uses lower-case variable names.

3336

delete the blank line

This revision is now accepted and ready to land.Dec 20 2022, 1:11 PM
This revision was landed with ongoing or failed builds.Jan 3 2023, 10:29 AM
This revision was automatically updated to reflect the committed changes.