[PATCH] D34758: [YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 06:45:56 PDT 2017


Isn't there something like IO.defaultCase? I can't check right now but I'm
pretty sure there is
On Thu, Jun 29, 2017 at 1:24 AM George Rimar via Phabricator <
reviews at reviews.llvm.org> wrote:

> grimar added a comment.
>
> In https://reviews.llvm.org/D34758#794033, @ruiu wrote:
>
> > It seems you can do this without modifying YAMLTraits.h. You can set
> some invalid value (such as -1) to `Value` at beginning of
> `ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration`  and then check if
> it still has the invalid value after the switch.
>
>
> That will work for jaml2obj case, but will not work for case when
> IO.outputting() == true unfortunately (obj2yaml case).
>
> In the latter case `Value` will have some value read from object. Then
> IO.enumCase() calls Output::matchEnumScalar(), which sets
> EnumerationMatchFound to true if enumeration was
> matched. This flag can be used to check that we found the enumeration, but
> it is private and I would prefer not to add accessor for it, its a part of
> internal implementation
> and too specific thing to provide access to, probably.
>
> That is why I added return value to enumCase instead. It looks more clear
> for my eye when enumCase() just can say whether it was able to handle the
> case or not.
>
>
> https://reviews.llvm.org/D34758
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/75a3cab0/attachment.html>


More information about the llvm-commits mailing list