Isn't there something like IO.defaultCase?  I can't check right now but I'm pretty sure there is<br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 29, 2017 at 1:24 AM George Rimar via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">grimar added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D34758#794033" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34758#794033</a>, @ruiu wrote:<br>
<br>
> 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.<br>
<br>
<br>
That will work for jaml2obj case, but will not work for case when IO.outputting() == true unfortunately (obj2yaml case).<br>
<br>
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<br>
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<br>
and too specific thing to provide access to, probably.<br>
<br>
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.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D34758" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34758</a><br>
<br>
<br>
<br>
</blockquote></div>