<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Jul 9, 2017 at 6:14 AM David Li 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">davidxl added a comment.<br>
<br>
It feels weird that the error handling is the first parameter of the interfaces.  </blockquote><div><br>Not sure it's too different - but clang-format does have a special case for lambdas as the last argument to a function, so it's a bit nicer that way - done!<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Also is it possible to provide a default error handling ?<br></blockquote><div><br>Not sure - I don't think there's any reasonable default for handling errors (or pseudo errors, more like guidelines/warnings in this case). Certainly llvm-profdata's the only user right now & doesn't want to ignore errors, for example.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
================<br>
Comment at: tools/llvm-profdata/llvm-profdata.cpp:164<br>
+    WC->Writer.addRecord(<br>
+        [&](Error E) {<br>
+          if (Reported) {<br>
----------------<br>
creating a named lambda is more readable IMO.<br></blockquote><div><br>Is it more readable now that it's formatted differently by having the lambda as the last argument? It's pretty rare to name lambdas used only once & should have quite similar formatting now (without the extra indentation).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D35149" rel="noreferrer" target="_blank">https://reviews.llvm.org/D35149</a><br>
<br>
<br>
<br>
</blockquote></div></div>