<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 1:45 PM, Nathan Slingerland <span dir="ltr"><<a href="mailto:slingn@gmail.com" target="_blank" class="cremed">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 class=""><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 class="">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><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>