[Patch] Removing static initializers from Signals.inc
Chandler Carruth
chandlerc at google.com
Thu Aug 28 16:48:45 PDT 2014
@@ -106,8 +104,8 @@ static void RegisterHandlers() {
// If the handlers are already registered, we're done.
if (NumRegisteredSignals != 0) return;
- std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
- std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
+ std::for_each(IntSigs, std::end(IntSigs), RegisterHandler);
+ std::for_each(KillSigs, std::end(KillSigs), RegisterHandler);
Just use a range based for loop?
for (auto S : IntSigs) RegisterHandler(S);
seems cleaner than the existing code...
}
static void UnregisterHandlers() {
@@ -166,7 +164,8 @@ static RETSIGTYPE SignalHandler(int Sig) {
{
unique_lock<SmartMutex<true>> Guard(SignalsMutex);
RemoveFilesToRemove();
-
+ const int *const IntSigsEnd = std::end(IntSigs);
+
if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) {
I would rewrite all of this to just use 'std::begin' and 'std::end'
directly rather than the variable.
if (InterruptFunction) {
void (*IF)() = InterruptFunction;
On Thu, Aug 28, 2014 at 3:31 PM, Chris Bieneman <beanz at apple.com> wrote:
> This patch has some small code cleanup to remove static initializers from
> Signals.inc.
>
> Thanks,
> -Chris
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140828/fff74243/attachment.html>
More information about the llvm-commits
mailing list