Alexey Samsonov | 8bd9098 | 2012-06-07 09:50:16 +0000 | [diff] [blame] | 1 | //===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file is shared between AddressSanitizer and ThreadSanitizer |
| 11 | // run-time libraries. |
| 12 | // |
| 13 | // The file provides 'placement new'. |
| 14 | // Do not include it into header files, only into source files. |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | #ifndef SANITIZER_PLACEMENT_NEW_H |
| 17 | #define SANITIZER_PLACEMENT_NEW_H |
| 18 | |
| 19 | #include "sanitizer_internal_defs.h" |
| 20 | |
Alexey Samsonov | 25c40e5 | 2012-06-15 14:32:39 +0000 | [diff] [blame] | 21 | namespace __sanitizer { |
| 22 | #if (__WORDSIZE == 64) || defined(__APPLE__) |
Alexey Samsonov | b13ac74 | 2012-06-19 07:40:45 +0000 | [diff] [blame] | 23 | typedef uptr operator_new_ptr_type; |
Alexey Samsonov | 8b9aea5 | 2012-06-07 10:09:41 +0000 | [diff] [blame] | 24 | #else |
Alexey Samsonov | b13ac74 | 2012-06-19 07:40:45 +0000 | [diff] [blame] | 25 | typedef u32 operator_new_ptr_type; |
Alexey Samsonov | 25c40e5 | 2012-06-15 14:32:39 +0000 | [diff] [blame] | 26 | #endif |
| 27 | } // namespace __sanitizer |
| 28 | |
Alexey Samsonov | b13ac74 | 2012-06-19 07:40:45 +0000 | [diff] [blame] | 29 | inline void *operator new(__sanitizer::operator_new_ptr_type sz, void *p) { |
Alexey Samsonov | 8b9aea5 | 2012-06-07 10:09:41 +0000 | [diff] [blame] | 30 | return p; |
| 31 | } |
Alexey Samsonov | 8bd9098 | 2012-06-07 09:50:16 +0000 | [diff] [blame] | 32 | |
| 33 | #endif // SANITIZER_PLACEMENT_NEW_H |