v8/src/asan.h
Clemens Hammacher 8ae6bc6068 [asan] Move asan macros to asan.h
Similar to msan.h, asan should get its own header file such that the
functionality can be reused.

R=ahaas@chromium.org

Bug: v8:7570
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Ib81e4ff4b1d08158df7730c32345d4facf9453b0
Reviewed-on: https://chromium-review.googlesource.com/1046656
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53073}
2018-05-08 14:14:34 +00:00

31 lines
949 B
C++

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// AddressSanitizer support.
#ifndef V8_ASAN_H_
#define V8_ASAN_H_
#include "src/base/macros.h"
#include "src/globals.h"
#ifdef V8_USE_ADDRESS_SANITIZER
#include <sanitizer/asan_interface.h>
#else // !V8_USE_ADDRESS_SANITIZER
#define ASAN_POISON_MEMORY_REGION(start, size) \
static_assert( \
(std::is_pointer<decltype(start)>::value || \
std::is_same<v8::internal::Address, decltype(start)>::value) && \
std::is_convertible<decltype(size), size_t>::value, \
"static type violation")
#define ASAN_UNPOISON_MEMORY_REGION(start, size) \
ASAN_POISON_MEMORY_REGION(start, size)
#endif // V8_USE_ADDRESS_SANITIZER
#endif // V8_ASAN_H_