summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/msan/msan_allocator.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-07-07 17:39:31 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-07-07 17:39:31 +0000
commit91bb8e0e3a6312f673b04454de2eeea0be682c0a (patch)
treeb1047d5cea1a03ee5b9c5526806f607bc91dbba5 /compiler-rt/lib/msan/msan_allocator.cc
parent761439962b996292e5c49a19f3b1ee6cd5584f70 (diff)
downloadbcm5719-llvm-91bb8e0e3a6312f673b04454de2eeea0be682c0a.tar.gz
bcm5719-llvm-91bb8e0e3a6312f673b04454de2eeea0be682c0a.zip
Generalize sanitizer allocator public interface.
Introduce new public header <sanitizer/allocator_interface.h> and a set of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc. that will eventually replace their tool-specific equivalents (__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific functions are now deprecated and implemented as stubs redirecting to __sanitizer_ versions (which are implemented differently in each tool). Replace all uses of __xsan_ versions with __sanitizer_ versions in unit and lit tests. llvm-svn: 212469
Diffstat (limited to 'compiler-rt/lib/msan/msan_allocator.cc')
-rw-r--r--compiler-rt/lib/msan/msan_allocator.cc36
1 files changed, 29 insertions, 7 deletions
diff --git a/compiler-rt/lib/msan/msan_allocator.cc b/compiler-rt/lib/msan/msan_allocator.cc
index cb8af279d7d..fb1788f2acc 100644
--- a/compiler-rt/lib/msan/msan_allocator.cc
+++ b/compiler-rt/lib/msan/msan_allocator.cc
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_allocator.h"
+#include "sanitizer_common/sanitizer_allocator_interface.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "msan.h"
#include "msan_allocator.h"
@@ -182,24 +183,45 @@ static uptr AllocationSize(const void *p) {
using namespace __msan;
-uptr __msan_get_current_allocated_bytes() {
+uptr __sanitizer_get_current_allocated_bytes() {
uptr stats[AllocatorStatCount];
allocator.GetStats(stats);
return stats[AllocatorStatAllocated];
}
+uptr __msan_get_current_allocated_bytes() {
+ return __sanitizer_get_current_allocated_bytes();
+}
-uptr __msan_get_heap_size() {
+uptr __sanitizer_get_heap_size() {
uptr stats[AllocatorStatCount];
allocator.GetStats(stats);
return stats[AllocatorStatMapped];
}
+uptr __msan_get_heap_size() {
+ return __sanitizer_get_heap_size();
+}
-uptr __msan_get_free_bytes() { return 1; }
+uptr __sanitizer_get_free_bytes() { return 1; }
+uptr __msan_get_free_bytes() {
+ return __sanitizer_get_free_bytes();
+}
-uptr __msan_get_unmapped_bytes() { return 1; }
+uptr __sanitizer_get_unmapped_bytes() { return 1; }
+uptr __msan_get_unmapped_bytes() {
+ return __sanitizer_get_unmapped_bytes();
+}
-uptr __msan_get_estimated_allocated_size(uptr size) { return size; }
+uptr __sanitizer_get_estimated_allocated_size(uptr size) { return size; }
+uptr __msan_get_estimated_allocated_size(uptr size) {
+ return __sanitizer_get_estimated_allocated_size(size);
+}
-int __msan_get_ownership(const void *p) { return AllocationSize(p) != 0; }
+int __sanitizer_get_ownership(const void *p) { return AllocationSize(p) != 0; }
+int __msan_get_ownership(const void *p) {
+ return __sanitizer_get_ownership(p);
+}
-uptr __msan_get_allocated_size(const void *p) { return AllocationSize(p); }
+uptr __sanitizer_get_allocated_size(const void *p) { return AllocationSize(p); }
+uptr __msan_get_allocated_size(const void *p) {
+ return __sanitizer_get_allocated_size(p);
+}
OpenPOWER on IntegriCloud