1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// AddressSanitizer support.
6
7#ifndef V8_ASAN_H_
8#define V8_ASAN_H_
9
10#include "src/base/macros.h"
11#include "src/globals.h"
12
13#ifdef V8_USE_ADDRESS_SANITIZER
14
15#include <sanitizer/asan_interface.h>
16
17#else // !V8_USE_ADDRESS_SANITIZER
18
19#define ASAN_POISON_MEMORY_REGION(start, size) \
20 static_assert(std::is_pointer<decltype(start)>::value && \
21 std::is_convertible<decltype(size), size_t>::value, \
22 "static type violation")
23#define ASAN_UNPOISON_MEMORY_REGION(start, size) \
24 ASAN_POISON_MEMORY_REGION(start, size)
25
26#endif // V8_USE_ADDRESS_SANITIZER
27
28#endif // V8_ASAN_H_
29