<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 16, 2015 at 2:02 PM, Xinliang David Li <span dir="ltr"><<a href="mailto:xinliangli@gmail.com" target="_blank" class="cremed">xinliangli@gmail.com</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"><div><div class="h5">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" class="cremed">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>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><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></div><div>Why do you think this obscure control flow? The name indicates it is a conditional return.</div></div></div></div></blockquote><div><br></div><div>Semantic overload. These macros tend to grow other things and they are a royal pain when stepping through with a debugger. I spent a long time trying to get rid of these macros in GCC. I don't want another codebase riddled with macros :)</div></div></div></div>