<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 7, 2016 at 6:21 PM Greg Clayton via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: gclayton<br class="gmail_msg">
Date: Wed Dec  7 20:11:03 2016<br class="gmail_msg">
New Revision: 289017<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289017&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=289017&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Unbreak buildbots where the debug info test was crashing due to unchecked error.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=289017&r1=289016&r2=289017&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=289017&r1=289016&r2=289017&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Wed Dec  7 20:11:03 2016<br class="gmail_msg">
@@ -51,14 +51,15 @@ Triple getHostTripleForAddrSize(uint8_t<br class="gmail_msg">
 /// \returns true if there were errors, false otherwise.<br class="gmail_msg">
 template <typename T><br class="gmail_msg">
 static bool HandleExpectedError(T &Expected) {<br class="gmail_msg">
-  if (!Expected)<br class="gmail_msg">
-    return false;<br class="gmail_msg">
   std::string ErrorMsg;<br class="gmail_msg">
   handleAllErrors(Expected.takeError(), [&](const llvm::ErrorInfoBase &EI) {<br class="gmail_msg">
     ErrorMsg = EI.message();<br class="gmail_msg">
   });<br class="gmail_msg">
-  ::testing::AssertionFailure() << "error: " << ErrorMsg;<br class="gmail_msg">
-  return true;<br class="gmail_msg">
+  if (!ErrorMsg.empty()) {<br class="gmail_msg">
+    ::testing::AssertionFailure() << "error: " << ErrorMsg;<br class="gmail_msg">
+    return true;<br class="gmail_msg">
+  }<br class="gmail_msg">
+  return false;<br class="gmail_msg"></blockquote><div><br>I think this could be written a bit simpler and without relying on the error string being non-empty, etc.<br><br>Oh, huh - Lang, any ideas?<br><br>It'd be nice if handleAllErrors could return a value (if all handlers returned the same/compatibible) - though I guess then it'd need a default value.<br><br>Lang, would it be more idiomatic here to test the error for non-failure ,return false, otherwise then handleAllErrors and return true.<br><br><br> </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">
 template <uint16_t Version, class AddrType, class RefAddrType><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>