[llvm-commits] [compiler-rt] r166180 - /compiler-rt/trunk/lib/asan/asan_new_delete.cc
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Thu Oct 18 08:22:09 PDT 2012
Author: eugenis
Date: Thu Oct 18 10:22:08 2012
New Revision: 166180
URL: http://llvm.org/viewvc/llvm-project?rev=166180&view=rev
Log:
[asan] Disable new/delete interceptors on Android and make them visible elsewhere.
Modified:
compiler-rt/trunk/lib/asan/asan_new_delete.cc
Modified: compiler-rt/trunk/lib/asan/asan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_new_delete.cc?rev=166180&r1=166179&r2=166180&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_new_delete.cc Thu Oct 18 10:22:08 2012
@@ -28,29 +28,37 @@
using namespace __asan; // NOLINT
+// On Android new() goes through malloc interceptors.
+#if !ASAN_ANDROID
+
#define OPERATOR_NEW_BODY \
GET_STACK_TRACE_HERE_FOR_MALLOC;\
return asan_memalign(0, size, &stack);
-#if ASAN_ANDROID
-void *operator new(size_t size) { OPERATOR_NEW_BODY; }
-void *operator new[](size_t size) { OPERATOR_NEW_BODY; }
-#else
+INTERCEPTOR_ATTRIBUTE
void *operator new(size_t size) throw(std::bad_alloc) { OPERATOR_NEW_BODY; }
+INTERCEPTOR_ATTRIBUTE
void *operator new[](size_t size) throw(std::bad_alloc) { OPERATOR_NEW_BODY; }
+INTERCEPTOR_ATTRIBUTE
void *operator new(size_t size, std::nothrow_t const&) throw()
{ OPERATOR_NEW_BODY; }
+INTERCEPTOR_ATTRIBUTE
void *operator new[](size_t size, std::nothrow_t const&) throw()
{ OPERATOR_NEW_BODY; }
-#endif
#define OPERATOR_DELETE_BODY \
GET_STACK_TRACE_HERE_FOR_FREE(ptr);\
asan_free(ptr, &stack);
+INTERCEPTOR_ATTRIBUTE
void operator delete(void *ptr) throw() { OPERATOR_DELETE_BODY; }
+INTERCEPTOR_ATTRIBUTE
void operator delete[](void *ptr) throw() { OPERATOR_DELETE_BODY; }
+INTERCEPTOR_ATTRIBUTE
void operator delete(void *ptr, std::nothrow_t const&) throw()
{ OPERATOR_DELETE_BODY; }
+INTERCEPTOR_ATTRIBUTE
void operator delete[](void *ptr, std::nothrow_t const&) throw()
{ OPERATOR_DELETE_BODY; }
+
+#endif
More information about the llvm-commits
mailing list