This is an archive of the discontinued LLVM Phabricator instance.

[yaml] Add support for Anchors and Aliases to yaml::Input
Needs ReviewPublic

Authored by njames93 on Jun 28 2022, 4:29 PM.

Details

Summary

Adds the necessary machinery to refer to anchors when parsing yaml

yaml
---
Foo: &FB 'FooBar'
Bar: *FB
...

This will be parsed as a dictionary containing {Foo: 'FooBar', Bar: 'FooBar'}

Diff Detail

Event Timeline

njames93 created this revision.Jun 28 2022, 4:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2022, 4:29 PM
njames93 requested review of this revision.Jun 28 2022, 4:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2022, 4:29 PM
njames93 updated this revision to Diff 441324.Jun 30 2022, 2:50 AM

Remove recursive nature of alias expansion as alias nodes cannot be anchored.

njames93 updated this revision to Diff 441328.Jun 30 2022, 3:00 AM

Missed something from last update.

lattner resigned from this revision.Jun 30 2022, 9:50 AM
jhenderson resigned from this revision.Jul 6 2022, 12:10 AM

Thanks for looking at this. Does the Yaml I/O documentation need updating (see llvm/docs/YamlIO.rst)?

Unfortunately, this area of code isn't really one I'm familiar enough with to review in detail, and I don't have time brush up on it sufficiently to be able to, so someone else will need to do the review.

Thanks for looking at this. Does the Yaml I/O documentation need updating (see llvm/docs/YamlIO.rst)?

I decided against updating the docs link to the YAML specification and this change is simply about bringing the YamlIO implementation more inline with the actual specification.