1 //===-- sanitizer/rtsan_interface.h -----------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is a part of RealtimeSanitizer.
11 // Public interface header.
12 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_RTSAN_INTERFACE_H
15 #define SANITIZER_RTSAN_INTERFACE_H
17 #include <sanitizer/common_interface_defs.h>
23 // Disable all RTSan error reporting.
24 // Must be paired with a call to `__rtsan_enable`
25 void SANITIZER_CDECL
__rtsan_disable(void);
27 // Re-enable all RTSan error reporting.
28 // Must follow a call to `__rtsan_disable`.
29 void SANITIZER_CDECL
__rtsan_enable(void);
35 #if defined(__has_feature) && __has_feature(realtime_sanitizer)
37 class ScopedDisabler
{
39 ScopedDisabler() { __rtsan_disable(); }
40 ~ScopedDisabler() { __rtsan_enable(); }
42 #if __cplusplus >= 201103L
43 ScopedDisabler(const ScopedDisabler
&) = delete;
44 ScopedDisabler
&operator=(const ScopedDisabler
&) = delete;
45 ScopedDisabler(ScopedDisabler
&&) = delete;
46 ScopedDisabler
&operator=(ScopedDisabler
&&) = delete;
49 ScopedDisabler(const ScopedDisabler
&);
50 ScopedDisabler
&operator=(const ScopedDisabler
&);
51 #endif // __cplusplus >= 201103L
56 class 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;
66 ScopedDisabler(const ScopedDisabler
&);
67 ScopedDisabler
&operator=(const ScopedDisabler
&);
68 #endif // __cplusplus >= 201103L
71 #endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
72 } // namespace __rtsan
75 #endif // SANITIZER_RTSAN_INTERFACE_H