<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 10:51 AM, Diego Novillo via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Dec 16, 2015 at 1:45 PM, Nathan Slingerland <span dir="ltr"><<a href="mailto:slingn@gmail.com" target="_blank">slingn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
================<br>
Comment at: include/llvm/ProfileData/SampleProf.h:145<br>
@@ -134,2 +144,3 @@<br>
S = SaturatingMultiply(S, Weight, &Overflowed);<br>
- assert(!Overflowed && "Sample counter overflowed!");<br>
+ if (Overflowed)<br>
+ return sampleprof_error::counter_overflow;<br>
----------------<br>
</span><span>davidxl wrote:<br>
> There are also lots of if(..) return patterns that can be simplified. This case you will need a macro:<br>
><br>
> #define RETURN_IF(Cond, Err) \<br>
> if(Cond) \<br>
> return Err;<br>
</span>I don't think we want to add macros to header files like this as macros don't respect namespaces. I'll see if I can simplify in another way.<br></blockquote><div><br></div></span><div>Agreed. I don't really like macros of any kind in headers (well, anywhere really). Particularly the kind that obscure control flow. I'd rather see the control flow in the code. </div></div></div></div></blockquote><div><br></div><div>Why do you think this obscure control flow? The name indicates it is a conditional return.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>