[mlir][py] Enable loading only specified dialects during creation. (#121421)
[llvm-project.git] / compiler-rt / include / sanitizer / rtsan_interface.h
blob5d7ce5345712e5a608d82ed2f07e381c98c17fca
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.
11 // Public interface header.
12 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_RTSAN_INTERFACE_H
15 #define SANITIZER_RTSAN_INTERFACE_H
17 #include <sanitizer/common_interface_defs.h>
19 #ifdef __cplusplus
20 extern "C" {
21 #endif // __cplusplus
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);
31 #ifdef __cplusplus
32 } // extern "C"
34 namespace __rtsan {
35 #if defined(__has_feature) && __has_feature(realtime_sanitizer)
37 class ScopedDisabler {
38 public:
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;
47 #else
48 private:
49 ScopedDisabler(const ScopedDisabler &);
50 ScopedDisabler &operator=(const ScopedDisabler &);
51 #endif // __cplusplus >= 201103L
54 #else
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
71 #endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
72 } // namespace __rtsan
73 #endif // __cplusplus
75 #endif // SANITIZER_RTSAN_INTERFACE_H