2012-06-07 17:50:16 +08:00
|
|
|
//===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===//
|
2012-05-10 21:48:04 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2012-06-07 17:50:16 +08:00
|
|
|
// This file is shared between AddressSanitizer and ThreadSanitizer
|
|
|
|
// run-time libraries.
|
2012-05-10 21:48:04 +08:00
|
|
|
//
|
2012-06-07 17:50:16 +08:00
|
|
|
// The file provides 'placement new'.
|
2012-05-10 21:48:04 +08:00
|
|
|
// Do not include it into header files, only into source files.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-06-07 17:50:16 +08:00
|
|
|
#ifndef SANITIZER_PLACEMENT_NEW_H
|
|
|
|
#define SANITIZER_PLACEMENT_NEW_H
|
2012-05-10 21:48:04 +08:00
|
|
|
|
2012-06-07 17:50:16 +08:00
|
|
|
#include "sanitizer_internal_defs.h"
|
2012-05-10 21:48:04 +08:00
|
|
|
|
2012-06-15 22:32:39 +08:00
|
|
|
namespace __sanitizer {
|
2012-11-21 20:38:58 +08:00
|
|
|
#if (SANITIZER_WORDSIZE == 64) || defined(__APPLE__)
|
2012-06-19 15:40:45 +08:00
|
|
|
typedef uptr operator_new_ptr_type;
|
2012-06-07 18:09:41 +08:00
|
|
|
#else
|
2012-06-19 15:40:45 +08:00
|
|
|
typedef u32 operator_new_ptr_type;
|
2012-06-15 22:32:39 +08:00
|
|
|
#endif
|
|
|
|
} // namespace __sanitizer
|
|
|
|
|
2012-06-19 15:40:45 +08:00
|
|
|
inline void *operator new(__sanitizer::operator_new_ptr_type sz, void *p) {
|
2012-06-07 18:09:41 +08:00
|
|
|
return p;
|
|
|
|
}
|
2012-05-10 21:48:04 +08:00
|
|
|
|
2012-06-07 17:50:16 +08:00
|
|
|
#endif // SANITIZER_PLACEMENT_NEW_H
|