sanitizer_placement_new.h revision 877bfcfaf592e63916333fd644bb8f30b673f35d
147b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov//===-- sanitizer_placement_new.h -------------------------------*- C++ -*-===//
27ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//
37ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//                     The LLVM Compiler Infrastructure
47ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//
57ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// This file is distributed under the University of Illinois Open Source
67ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// License. See LICENSE.TXT for details.
77ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//
87ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//===----------------------------------------------------------------------===//
97ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//
1047b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov// This file is shared between AddressSanitizer and ThreadSanitizer
1147b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov// run-time libraries.
127ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//
1347b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov// The file provides 'placement new'.
147ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany// Do not include it into header files, only into source files.
157ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany//===----------------------------------------------------------------------===//
1647b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov#ifndef SANITIZER_PLACEMENT_NEW_H
1747b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov#define SANITIZER_PLACEMENT_NEW_H
187ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
1947b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov#include "sanitizer_internal_defs.h"
207ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
21877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonovnamespace __sanitizer {
22877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonov#if (__WORDSIZE == 64) || defined(__APPLE__)
23877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonovtypedef __sanitizer::uptr operator_new_ptr_type;
249fe7b96f92606057dacb9130c08d32430d8be86fAlexey Samsonov#else
25877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonovtypedef __sanitizer::u32 operator_new_ptr_type;
26877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonov#endif
27877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonov}  // namespace __sanitizer
28877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonov
29877bfcfaf592e63916333fd644bb8f30b673f35dAlexey Samsonovinline void *operator new(operator_new_ptr_type sz, void *p) {
309fe7b96f92606057dacb9130c08d32430d8be86fAlexey Samsonov  return p;
319fe7b96f92606057dacb9130c08d32430d8be86fAlexey Samsonov}
327ac41484ea322e0ea5774df681660269f5dc321eKostya Serebryany
3347b1634df012507799eb39aa17d4022d748ba67bAlexey Samsonov#endif  // SANITIZER_PLACEMENT_NEW_H
34