<div dir="ltr">Such a function might even go in Dwarf.h/Dwarf.cpp<br><br>(& do we have any (/should we add some) for these various attributes? The test case updates touch on a few of these attributes, but not all of them)</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 3, 2014 at 1:56 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Perhaps we could avoid the goto & offload some of the repetition from the macro like this:<br><br>const char *Name = nullptr;<br><br>switch (attr) {<br>#define ENUM_TO_STRING_ATTRIBUTE(NAME)<br>  if (Optional<uint64_t> Val = formValue.getAsUnsignedConstant())<br>

    Name = NAME##String(*Val);<br>  break;<br><br>  case ...<br>    ...<br>  // no default here<br>}<br><br>if (Name)<br>  OS << Name;<br>else<br>  formValue.dump(OS, u);<br><br>Or even refactor the switch into a function, then you can just have this in the macro:<br>

<br>  if (Optional<uint64_t> Val = ...)<br>    return *Val;<br><br>and a "return nullptr" at the end.</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Wed, Sep 3, 2014 at 1:38 PM, Frédéric Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div style="word-wrap:break-word">Here is a new version rebased on the reviewed FormValue accessor patch.<div>
<br></div>
<div>OK?<br><div></div></div></div><br></div><div><div class="h5"><div style="word-wrap:break-word"><div><div><br><div><blockquote type="cite"><div>On 03 Sep 2014, at 21:12, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:</div>

<br><div><blockquote type="cite" style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">

<br>On Sep 3, 2014, at 12:03 PM, Frédéric Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br><br><br><blockquote type="cite">On 03 Sep 2014, at 20:57, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:<br>

<br><br><blockquote type="cite">On Sep 3, 2014, at 11:52 AM, Frédéric Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br><br>This patch introduces symbolic dump of all the DWARF standard values (defined in Dwarf.h). It requires the previous DWARFFormValue accessor patch. The fixed accessibility test shows that it’s much easier to check that the test is actually correct, rather than having to cross-check with the enumerator value.<br>

<br>OK?<br><dwarfdump-SymbolicAttributes.diff><br></blockquote><br>If you look at lib/Support/Dwarf.cpp, there is already a similar switch table for converting all the attribute names. We should probably only have one such implementation.<br>

</blockquote><br>Really, which one? I see tables converting from various enum to const char * value, but my switch associates DW_AT_* attributes with the corresponding attribute enumeration. This patch uses all the switch functions in Dwarf.cpp, but AFAICS it doesn’t duplicate anything. But maybe I’m looking at the wrong place?<br>

</blockquote><br style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">

<span style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">My apologies, you are correct! That email went out too fast.</span><br style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">

<br style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">

<span style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">-- adrian</span></div>

</blockquote></div><br></div></div></div><br></div></div></blockquote></div><br></div>
</blockquote></div><br></div>