<div dir="ltr">Sure, LGTM. I think clang-format will format the for loops differently, but I don't care.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 5:05 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Makes sense. How does this look?<span class="HOEnZb"><font color="#888888"><div><br><div>
-Chris</div><div><br></div><div></div></div></font></span></div>
<br><div style="word-wrap:break-word"><div><div></div><div><br><div><div>On Aug 28, 2014, at 4:48 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>> wrote:</div><br>
<blockquote type="cite"><div dir="ltr"><div>@@ -106,8 +104,8 @@ static void RegisterHandlers() {</div><div> // If the handlers are already registered, we're done.</div><div> if (NumRegisteredSignals != 0) return;</div>
<div> </div><div>- std::for_each(IntSigs, IntSigsEnd, RegisterHandler);</div>
<div>- std::for_each(KillSigs, KillSigsEnd, RegisterHandler);</div><div>+ std::for_each(IntSigs, std::end(IntSigs), RegisterHandler);</div><div>+ std::for_each(KillSigs, std::end(KillSigs), RegisterHandler);</div><div>
<br></div><div>Just use a range based for loop?</div><div><br></div><div>for (auto S : IntSigs) RegisterHandler(S);</div><div><br></div><div>seems cleaner than the existing code...</div><div><br></div><div><br></div><div>
}</div><div> </div><div> static void UnregisterHandlers() {</div><div>@@ -166,7 +164,8 @@ static RETSIGTYPE SignalHandler(int Sig) {</div><div> {</div><div> unique_lock<SmartMutex<true>> Guard(SignalsMutex);</div>
<div> RemoveFilesToRemove();</div><div>-</div><div>+ const int *const IntSigsEnd = std::end(IntSigs);</div><div>+ </div><div> if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) {</div><div><br></div><div>
I would rewrite all of this to just use 'std::begin' and 'std::end' directly rather than the variable.</div><div><br></div><div> if (InterruptFunction) {</div><div> void (*IF)() = InterruptFunction;</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 3:31 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch has some small code cleanup to remove static initializers from Signals.inc.<br>
<br>
Thanks,<br>
-Chris<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div>
<br></blockquote></div><br></div>