[sanitizer] Move __sanitizer_set_death_callback to a more appropriate file
authorKostya Kortchinsky <kostyak@google.com>
Fri, 21 Sep 2018 17:05:56 +0000 (17:05 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Fri, 21 Sep 2018 17:05:56 +0000 (17:05 +0000)
Summary:
`__sanitizer_set_death_callback` is a public interface function wrapping
`SetUserDieCallback`. Said function is defined in `sanitizer_termination.cc`,
which is not included in all the RT. Moving the interface function to that
file allows to not have a spurious public fuinction in RT that don't use it.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D52363

llvm-svn: 342747

compiler-rt/lib/sanitizer_common/sanitizer_common.cc
compiler-rt/lib/sanitizer_common/sanitizer_termination.cc

index 7d72b0c..6868961 100644 (file)
@@ -339,11 +339,6 @@ int __sanitizer_acquire_crash_state() {
 }
 
 SANITIZER_INTERFACE_ATTRIBUTE
-void __sanitizer_set_death_callback(void (*callback)(void)) {
-  SetUserDieCallback(callback);
-}
-
-SANITIZER_INTERFACE_ATTRIBUTE
 int __sanitizer_install_malloc_and_free_hooks(void (*malloc_hook)(const void *,
                                                                   uptr),
                                               void (*free_hook)(const void *)) {
index 8243fc0..35e4403 100644 (file)
@@ -84,3 +84,12 @@ void NORETURN CheckFailed(const char *file, int line, const char *cond,
 }
 
 } // namespace __sanitizer
+
+using namespace __sanitizer;  // NOLINT
+
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __sanitizer_set_death_callback(void (*callback)(void)) {
+  SetUserDieCallback(callback);
+}
+}  // extern "C"