msan.h 898 Bytes
Newer Older
1
// Copyright 2013 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5 6 7 8 9

// MemorySanitizer support.

#ifndef V8_MSAN_H_
#define V8_MSAN_H_

10
#include "src/globals.h"
11

12 13 14 15
#ifndef __has_feature
# define __has_feature(x) 0
#endif

16
#if __has_feature(memory_sanitizer) && !defined(MEMORY_SANITIZER)
17 18 19
# define MEMORY_SANITIZER
#endif

20
#if defined(MEMORY_SANITIZER)
21
# include <sanitizer/msan_interface.h>  // NOLINT
22 23 24 25

// Marks a memory range as uninitialized, as if it was allocated here.
# define MSAN_ALLOCATED_UNINITIALIZED_MEMORY(p, s) \
    __msan_allocated_memory((p), (s))
26 27
// Marks a memory range as initialized.
#define MSAN_MEMORY_IS_INITIALIZED(p, s) __msan_unpoison((p), (s))
28 29
#else
# define MSAN_ALLOCATED_UNINITIALIZED_MEMORY(p, s)
30
#define MSAN_MEMORY_IS_INITIALIZED(p, s)
31 32
#endif

33
#endif  // V8_MSAN_H_