[PATCH] D24162: [yaml] Add the ability to pass in context at the map level
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 15:06:18 PDT 2016
zturner created this revision.
zturner added reviewers: lhames, majnemer.
zturner added a subscriber: llvm-commits.
When doing `mapRequired` or `mapOptional` it is useful to be able to pass context to the operation. This has been partially addressed by having a `void *context` in the `IO` instance, but this is inflexible when you context is constructed on the fly, for example, and needs to be passed to only one specific mapping.
The solution implemented here adds an additional overload of `mapRequired` and `mapOptional`, taking a parameterized type. If you invoke this overload, you are expected to specialize a `MappingTraits` with not only the default implementation which takes a n `IO&` and a `T &`, but an additional overload that takes an `IO&`, `T &`, and `Context &`. This object is then passed into the map operation. The original no context overload is still required
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 14210 bytes
Desc: not available
More information about the llvm-commits