v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
lsan.h
Go to the documentation of this file.
1// Copyright 2019 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#ifndef V8_BASE_SANITIZER_LSAN_H_
6#define V8_BASE_SANITIZER_LSAN_H_
7
8// LeakSanitizer support.
9
10#include <type_traits>
11
12#include "src/base/macros.h"
13
14// There is no compile time flag for LSan, so enable this whenever ASan is
15// enabled. Note that LSan can be used as part of ASan with 'detect_leaks=1'.
16// On Windows, LSan is not implemented yet, so disable it there.
17#if defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
18
19#include <sanitizer/lsan_interface.h>
20
21#define LSAN_IGNORE_OBJECT(ptr) __lsan_ignore_object(ptr)
22
23#else // defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
24
25#define LSAN_IGNORE_OBJECT(ptr) \
26 static_assert(std::is_convertible<decltype(ptr), const void*>::value, \
27 "LSAN_IGNORE_OBJECT can only be used with pointer types")
28
29#endif // defined(V8_USE_ADDRESS_SANITIZER) && !defined(V8_OS_WIN)
30
31#endif // V8_BASE_SANITIZER_LSAN_H_