[ASan] An early return from InitializeAsanInterceptors() on Mac has been considered...
authorAlexander Potapenko <glider@google.com>
Fri, 7 Jun 2013 15:10:02 +0000 (15:10 +0000)
committerAlexander Potapenko <glider@google.com>
Fri, 7 Jun 2013 15:10:02 +0000 (15:10 +0000)
Remove it and replace ASAN_INTERCEPT_FUNC with a no-op if SANITIZER_MAC==1.

llvm-svn: 183524

compiler-rt/lib/asan/asan_interceptors.cc

index 11bb2976504692866ef9cc02dbd560c42c4d0365..bfd82b4a1d366f6588eeaa0015c4206f46dca89b 100644 (file)
@@ -657,10 +657,15 @@ INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
 }
 #endif  // ASAN_INTERCEPT___CXA_ATEXIT
 
+#if !SANITIZER_MAC
 #define ASAN_INTERCEPT_FUNC(name) do { \
       if (!INTERCEPT_FUNCTION(name) && flags()->verbosity > 0) \
         Report("AddressSanitizer: failed to intercept '" #name "'\n"); \
     } while (0)
+#else
+// OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION.
+#define ASAN_INTERCEPT_FUNC(name)
+#endif  // SANITIZER_MAC
 
 #if SANITIZER_WINDOWS
 INTERCEPTOR_WINAPI(DWORD, CreateThread,
@@ -693,9 +698,6 @@ void InitializeAsanInterceptors() {
   static bool was_called_once;
   CHECK(was_called_once == false);
   was_called_once = true;
-#if SANITIZER_MAC
-  return;
-#else
   SANITIZER_COMMON_INTERCEPTORS_INIT;
 
   // Intercept mem* functions.
@@ -780,7 +782,6 @@ void InitializeAsanInterceptors() {
   if (flags()->verbosity > 0) {
     Report("AddressSanitizer: libc interceptors initialized\n");
   }
-#endif  // SANITIZER_MAC
 }
 
 }  // namespace __asan