[all-commits] [llvm/llvm-project] 64e779: [llvm][YAML] Support aliases (anchors) in YAMLIO (...
sizn-sc via All-commits
all-commits at lists.llvm.org
Wed Apr 29 05:53:53 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 64e7798697a2a57c97afb8312cfd86d966d1e18a
https://github.com/llvm/llvm-project/commit/64e7798697a2a57c97afb8312cfd86d966d1e18a
Author: sizn-sc <152507218+sizn-sc at users.noreply.github.com>
Date: 2026-04-29 (Wed, 29 Apr 2026)
Changed paths:
M llvm/include/llvm/Support/YAMLTraits.h
M llvm/lib/Support/YAMLTraits.cpp
M llvm/unittests/Support/YAMLIOTest.cpp
Log Message:
-----------
[llvm][YAML] Support aliases (anchors) in YAMLIO (#146371)
This change makes it possible to use YAML anchors [1], [2] with
YAMLTraits. All of the necessary parser machinery already exists, so the
only change that is necessary is to wire it up to YAMLTraits.
This is done by keeping track of all `Anchor` -> `HNode *` mappings and
reusing those when an `AliasNode` is encountered.
In accordance with the spec [2], anchors do not have to be unique and
refer to the last occurrence in the serialization.
Example usage:
```yaml
foo: &a 42
bar: *a
```
The above would be deserialized as:
```yaml
foo: 42
bar: 42
```
Note that aliases are a serialization detail and can be discarded during
composition into a Representation Graph (`HNode` hierarchy).
[1]: https://yaml.org/spec/1.2.2/#692-node-anchors
[2]: https://yaml.org/spec/1.2.2/#3222-anchors-and-aliases
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list