<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 11, 2017, at 10:01 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Jan 11, 2017 at 9:53 AM Greg Clayton via Phabricator <<a href="mailto:reviews@reviews.llvm.org" class="">reviews@reviews.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">clayborg added a comment.<br class="gmail_msg">
<br class="gmail_msg">
I will leave the tests using getValueOr() for now as I would like it to fail nicely so we can get a complete snapshot of what is failing instead of crashing on any failure and not knowing how many others tests would fail.</blockquote><div class=""><br class=""></div><div class="">Fair enough - another tradeoff to be aware of there is that by collapsing the value-or-no-value states with getValueOr (or similarly with the previous code) it makes the failures harder to understand in some ways - if the EXPECT fails and the value is 0, is it because the value wasn't present, or because the value was present but was 0?<br class=""><br class="">All good - mostly I mentioned it because the lines seemed to be egtting a bit long/verbose and figured it might also make the tests easier to follow by removing some clutter.</div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>The length of the DWARFDie getAttributeValueAs functions, which were ported from DWARFDebugInfoEntry, was a patch I was thinking about. Does anyone have an objection to shortening all of the DWARFDie::getAttributeValueAsXXX() calls to have shorter names?</div><div><br class=""></div><div>I was thinking:</div><div><br class=""></div><div><div>From the current:</div><div><br class=""></div><div>  Optional<DWARFFormValue> getAttributeValue(dwarf::Attribute Attr) const;</div><div>  const char *getAttributeValueAsString(dwarf::Attribute Attr, const char *FailValue) const;</div><div>  Optional<uint64_t> getAttributeValueAsAddress(dwarf::Attribute Attr) const;</div><div>  Optional<int64_t> getAttributeValueAsSignedConstant(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttributeValueAsUnsignedConstant(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttributeValueAsReference(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttributeValueAsSectionOffset(dwarf::Attribute Attr) const;</div><div>  DWARFDie getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const;</div><div><br class=""></div><div>It would be nice to change “getAttributeValue” to “getAttr” and remove the “Constant” from UnsignedConstant” and SignedConstant”:</div><div><br class=""></div><div>The shorter versions would look like:</div><div><br class=""></div><div>  Optional<DWARFFormValue> getAttr(dwarf::Attribute Attr) const;</div><div>  const char *getAttrAsString(dwarf::Attribute Attr, const char *FailValue) const;</div><div>  Optional<uint64_t> getAttrAsAddress(dwarf::Attribute Attr) const;</div><div>  Optional<int64_t> getAttrAsSigned(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttrAsUnsigned(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttrAsReference(dwarf::Attribute Attr) const;</div><div>  Optional<uint64_t> getAttrAsSectionOffset(dwarf::Attribute Attr) const;</div><div>  DWARFDie getAttrAsDie(dwarf::Attribute Attr) const;</div><div><br class=""></div><div>This would help a lot of the DWARF code out. Any thoughts or objections?</div><div><br class=""></div></div><div><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"></div></div></blockquote></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I will read up on EXPECT_* and make a separate change for switching arg order if needed.<br class="gmail_msg"></blockquote><div class=""><br class="">Cool cool - thanks! The order of arguments catches me up every time.<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D28569" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D28569</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div></div>
</div></blockquote></div><br class=""></body></html>