Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/compiler-rt/include/sanitizer/rtsan_interface.h
213766 views
1
//===-- sanitizer/rtsan_interface.h -----------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file is a part of RealtimeSanitizer.
10
//
11
// Public interface header.
12
//===----------------------------------------------------------------------===//
13
14
#ifndef SANITIZER_RTSAN_INTERFACE_H
15
#define SANITIZER_RTSAN_INTERFACE_H
16
17
#include <sanitizer/common_interface_defs.h>
18
19
#ifdef __cplusplus
20
extern "C" {
21
#endif // __cplusplus
22
23
// Disable all RTSan error reporting.
24
// Must be paired with a call to `__rtsan_enable`
25
void SANITIZER_CDECL __rtsan_disable(void);
26
27
// Re-enable all RTSan error reporting.
28
// Must follow a call to `__rtsan_disable`.
29
void SANITIZER_CDECL __rtsan_enable(void);
30
31
#ifdef __cplusplus
32
} // extern "C"
33
34
namespace __rtsan {
35
#if defined(__has_feature) && __has_feature(realtime_sanitizer)
36
37
class ScopedDisabler {
38
public:
39
ScopedDisabler() { __rtsan_disable(); }
40
~ScopedDisabler() { __rtsan_enable(); }
41
42
#if __cplusplus >= 201103L
43
ScopedDisabler(const ScopedDisabler &) = delete;
44
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
45
ScopedDisabler(ScopedDisabler &&) = delete;
46
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
47
#else
48
private:
49
ScopedDisabler(const ScopedDisabler &);
50
ScopedDisabler &operator=(const ScopedDisabler &);
51
#endif // __cplusplus >= 201103L
52
};
53
54
#else
55
56
class ScopedDisabler {
57
public:
58
ScopedDisabler() {}
59
#if __cplusplus >= 201103L
60
ScopedDisabler(const ScopedDisabler &) = delete;
61
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
62
ScopedDisabler(ScopedDisabler &&) = delete;
63
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
64
#else
65
private:
66
ScopedDisabler(const ScopedDisabler &);
67
ScopedDisabler &operator=(const ScopedDisabler &);
68
#endif // __cplusplus >= 201103L
69
};
70
71
#endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
72
} // namespace __rtsan
73
#endif // __cplusplus
74
75
#endif // SANITIZER_RTSAN_INTERFACE_H
76
77