[llvm-commits] [compiler-rt] r153179 - in /compiler-rt/trunk/lib/asan: Makefile.old asan_interceptors.cc asan_interceptors.h asan_mac.cc asan_mac.h

Alexey Samsonov samsonov at google.com
Wed Mar 21 05:29:55 PDT 2012


Author: samsonov
Date: Wed Mar 21 07:29:54 2012
New Revision: 153179

URL: http://llvm.org/viewvc/llvm-project?rev=153179&view=rev
Log:
[asan]: remove asan_mac.h

Removed:
    compiler-rt/trunk/lib/asan/asan_mac.h
Modified:
    compiler-rt/trunk/lib/asan/Makefile.old
    compiler-rt/trunk/lib/asan/asan_interceptors.cc
    compiler-rt/trunk/lib/asan/asan_interceptors.h
    compiler-rt/trunk/lib/asan/asan_mac.cc

Modified: compiler-rt/trunk/lib/asan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/Makefile.old?rev=153179&r1=153178&r2=153179&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/Makefile.old (original)
+++ compiler-rt/trunk/lib/asan/Makefile.old Wed Mar 21 07:29:54 2012
@@ -173,7 +173,6 @@
 	asan_interceptors.h \
 	asan_interface.h \
 	asan_lock.h \
-	asan_mac.h \
 	asan_mapping.h \
 	asan_procmaps.h \
 	asan_stack.h \

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=153179&r1=153178&r2=153179&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Wed Mar 21 07:29:54 2012
@@ -16,7 +16,6 @@
 #include "asan_allocator.h"
 #include "asan_interface.h"
 #include "asan_internal.h"
-#include "asan_mac.h"
 #include "asan_mapping.h"
 #include "asan_stack.h"
 #include "asan_stats.h"
@@ -697,14 +696,6 @@
   // Intercept threading-related functions
 #if !defined(_WIN32)
   CHECK(INTERCEPT_FUNCTION(pthread_create));
-# if defined(__APPLE__)
-  // We don't need to intercept pthread_workqueue_additem_np() to support the
-  // libdispatch API, but it helps us to debug the unsupported functions. Let's
-  // intercept it only during verbose runs.
-  if (FLAG_v >= 2) {
-    CHECK(INTERCEPT_FUNCTION(pthread_workqueue_additem_np));
-  }
-# endif
 #endif
 
   // Some Windows-specific interceptors.
@@ -714,12 +705,7 @@
 
   // Some Mac-specific interceptors.
 #if defined(__APPLE__)
-  CHECK(INTERCEPT_FUNCTION(dispatch_async_f));
-  CHECK(INTERCEPT_FUNCTION(dispatch_sync_f));
-  CHECK(INTERCEPT_FUNCTION(dispatch_after_f));
-  CHECK(INTERCEPT_FUNCTION(dispatch_barrier_async_f));
-  CHECK(INTERCEPT_FUNCTION(dispatch_group_async_f));
-
+  InitializeMacGCDInterceptors();
   // http://code.google.com/p/address-sanitizer/issues/detail?id=10
   PatchCFStringCreateCopy();
 #endif

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=153179&r1=153178&r2=153179&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Wed Mar 21 07:29:54 2012
@@ -46,6 +46,11 @@
 
 void InitializeAsanInterceptors();
 
+#if defined(__APPLE__)
+void InitializeMacGCDInterceptors();
+void PatchCFStringCreateCopy();
+#endif  // __APPLE__
+
 }  // namespace __asan
 
 #endif  // ASAN_INTERCEPTORS_H

Modified: compiler-rt/trunk/lib/asan/asan_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mac.cc?rev=153179&r1=153178&r2=153179&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mac.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_mac.cc Wed Mar 21 07:29:54 2012
@@ -14,8 +14,6 @@
 
 #ifdef __APPLE__
 
-#include "asan_mac.h"
-
 #include "asan_interceptors.h"
 #include "asan_internal.h"
 #include "asan_mapping.h"
@@ -429,6 +427,38 @@
 // The implementation details are at
 //   http://libdispatch.macosforge.org/trac/browser/trunk/src/queue.c
 
+typedef void* pthread_workqueue_t;
+typedef void* pthread_workitem_handle_t;
+
+typedef void* dispatch_group_t;
+typedef void* dispatch_queue_t;
+typedef uint64_t dispatch_time_t;
+typedef void (*dispatch_function_t)(void *block);
+typedef void* (*worker_t)(void *block);
+
+// A wrapper for the ObjC blocks used to support libdispatch.
+typedef struct {
+  void *block;
+  dispatch_function_t func;
+  int parent_tid;
+} asan_block_context_t;
+
+extern "C" {
+void dispatch_async_f(dispatch_queue_t dq, void *ctxt,
+                      dispatch_function_t func);
+void dispatch_sync_f(dispatch_queue_t dq, void *ctxt,
+                     dispatch_function_t func);
+void dispatch_after_f(dispatch_time_t when, dispatch_queue_t dq, void *ctxt,
+                      dispatch_function_t func);
+void dispatch_barrier_async_f(dispatch_queue_t dq, void *ctxt,
+                              dispatch_function_t func);
+void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t dq,
+                            void *ctxt, dispatch_function_t func);
+int pthread_workqueue_additem_np(pthread_workqueue_t workq,
+    void *(*workitem_func)(void *), void * workitem_arg,
+    pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
+}  // extern "C"
+
 extern "C"
 void asan_dispatch_call_block_and_release(void *block) {
   GET_STACK_TRACE_HERE(kStackTraceMax);
@@ -613,6 +643,19 @@
 }
 
 namespace __asan {
+void InitializeMacGCDInterceptors() {
+  CHECK(INTERCEPT_FUNCTION(dispatch_async_f));
+  CHECK(INTERCEPT_FUNCTION(dispatch_sync_f));
+  CHECK(INTERCEPT_FUNCTION(dispatch_after_f));
+  CHECK(INTERCEPT_FUNCTION(dispatch_barrier_async_f));
+  CHECK(INTERCEPT_FUNCTION(dispatch_group_async_f));
+  // We don't need to intercept pthread_workqueue_additem_np() to support the
+  // libdispatch API, but it helps us to debug the unsupported functions. Let's
+  // intercept it only during verbose runs.
+  if (FLAG_v >= 2) {
+    CHECK(INTERCEPT_FUNCTION(pthread_workqueue_additem_np));
+  }
+}
 void PatchCFStringCreateCopy() {
   // Normally CFStringCreateCopy should not copy constant CF strings.
   // Replacing the default CFAllocator causes constant strings to be copied

Removed: compiler-rt/trunk/lib/asan/asan_mac.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mac.h?rev=153178&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mac.h (original)
+++ compiler-rt/trunk/lib/asan/asan_mac.h (removed)
@@ -1,86 +0,0 @@
-//===-- asan_mac.h ----------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of AddressSanitizer, an address sanity checker.
-//
-// ASan-private header for asan_mac.cc
-//===----------------------------------------------------------------------===//
-#ifdef __APPLE__
-
-#ifndef ASAN_MAC_H
-#define ASAN_MAC_H
-
-#include "asan_interceptors.h"
-
-typedef void* pthread_workqueue_t;
-typedef void* pthread_workitem_handle_t;
-
-typedef void* dispatch_group_t;
-typedef void* dispatch_queue_t;
-typedef uint64_t dispatch_time_t;
-typedef void (*dispatch_function_t)(void *block);
-typedef void* (*worker_t)(void *block);
-
-namespace __asan {
-void PatchCFStringCreateCopy();
-}  // namespace __asan
-
-DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_async_f, dispatch_queue_t dq,
-                                                     void *ctxt,
-                                                     dispatch_function_t func);
-DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_sync_f, dispatch_queue_t dq,
-                                                    void *ctxt,
-                                                    dispatch_function_t func);
-DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_after_f, dispatch_time_t when,
-                                                     dispatch_queue_t dq,
-                                                     void *ctxt,
-                                                     dispatch_function_t func);
-DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_barrier_async_f,
-                                   dispatch_queue_t dq,
-                                   void *ctxt,
-                                   dispatch_function_t func);
-DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_group_async_f,
-                                   dispatch_group_t group,
-                                   dispatch_queue_t dq,
-                                   void *ctxt,
-                                   dispatch_function_t func);
-DECLARE_REAL_AND_INTERCEPTOR(int, pthread_workqueue_additem_np,
-                                  pthread_workqueue_t workq,
-                                  void *(*workitem_func)(void *),
-                                  void * workitem_arg,
-                                  pthread_workitem_handle_t * itemhandlep,
-                                  unsigned int *gencountp);
-
-// A wrapper for the ObjC blocks used to support libdispatch.
-typedef struct {
-  void *block;
-  dispatch_function_t func;
-  int parent_tid;
-} asan_block_context_t;
-
-
-extern "C" {
-void dispatch_async_f(dispatch_queue_t dq, void *ctxt,
-                      dispatch_function_t func);
-void dispatch_sync_f(dispatch_queue_t dq, void *ctxt,
-                     dispatch_function_t func);
-void dispatch_after_f(dispatch_time_t when, dispatch_queue_t dq, void *ctxt,
-                      dispatch_function_t func);
-void dispatch_barrier_async_f(dispatch_queue_t dq, void *ctxt,
-                              dispatch_function_t func);
-void dispatch_group_async_f(dispatch_group_t group, dispatch_queue_t dq,
-                            void *ctxt, dispatch_function_t func);
-int pthread_workqueue_additem_np(pthread_workqueue_t workq,
-    void *(*workitem_func)(void *), void * workitem_arg,
-    pthread_workitem_handle_t * itemhandlep, unsigned int *gencountp);
-}
-
-#endif  // ASAN_MAC_H
-
-#endif  // __APPLE__





More information about the llvm-commits mailing list