[PATCH] D33158: [compiler-rt] Replace ifs with switch statement in IsHandledDeadlySignal
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 16:26:56 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303392: [compiler-rt] Replace ifs with switch statement in IsHandledDeadlySignal (authored by vitalybuka).
Changed prior to commit:
https://reviews.llvm.org/D33158?vs=99508&id=99509#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33158
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -394,18 +394,22 @@
}
bool IsHandledDeadlySignal(int signum) {
+ // Handling fatal signals on watchOS and tvOS devices is disallowed.
if ((SANITIZER_WATCHOS || SANITIZER_TVOS) && !(SANITIZER_IOSSIM))
- // Handling fatal signals on watchOS and tvOS devices is disallowed.
return false;
- if (common_flags()->handle_abort && signum == SIGABRT)
- return true;
- if (common_flags()->handle_sigill && signum == SIGILL)
- return true;
- if (common_flags()->handle_sigfpe && signum == SIGFPE)
- return true;
- if (common_flags()->handle_segv && signum == SIGSEGV)
- return true;
- return common_flags()->handle_sigbus && signum == SIGBUS;
+ switch (signum) {
+ case SIGABRT:
+ return common_flags()->handle_abort;
+ case SIGILL:
+ return common_flags()->handle_sigill;
+ case SIGFPE:
+ return common_flags()->handle_sigfpe;
+ case SIGSEGV:
+ return common_flags()->handle_segv;
+ case SIGBUS:
+ return common_flags()->handle_sigbus;
+ }
+ return false;
}
MacosVersion cached_macos_version = MACOS_VERSION_UNINITIALIZED;
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
@@ -1395,15 +1395,19 @@
#endif
bool IsHandledDeadlySignal(int signum) {
- if (common_flags()->handle_abort && signum == SIGABRT)
- return true;
- if (common_flags()->handle_sigill && signum == SIGILL)
- return true;
- if (common_flags()->handle_sigfpe && signum == SIGFPE)
- return true;
- if (common_flags()->handle_segv && signum == SIGSEGV)
- return true;
- return common_flags()->handle_sigbus && signum == SIGBUS;
+ switch (signum) {
+ case SIGABRT:
+ return common_flags()->handle_abort;
+ case SIGILL:
+ return common_flags()->handle_sigill;
+ case SIGFPE:
+ return common_flags()->handle_sigfpe;
+ case SIGSEGV:
+ return common_flags()->handle_segv;
+ case SIGBUS:
+ return common_flags()->handle_sigbus;
+ }
+ return false;
}
#if !SANITIZER_GO
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33158.99509.patch
Type: text/x-patch
Size: 2424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/ee600f52/attachment.bin>
More information about the llvm-commits
mailing list