Path: blob/main/contrib/llvm-project/compiler-rt/include/sanitizer/rtsan_interface.h
213766 views
//===-- sanitizer/rtsan_interface.h -----------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of RealtimeSanitizer.9//10// Public interface header.11//===----------------------------------------------------------------------===//1213#ifndef SANITIZER_RTSAN_INTERFACE_H14#define SANITIZER_RTSAN_INTERFACE_H1516#include <sanitizer/common_interface_defs.h>1718#ifdef __cplusplus19extern "C" {20#endif // __cplusplus2122// Disable all RTSan error reporting.23// Must be paired with a call to `__rtsan_enable`24void SANITIZER_CDECL __rtsan_disable(void);2526// Re-enable all RTSan error reporting.27// Must follow a call to `__rtsan_disable`.28void SANITIZER_CDECL __rtsan_enable(void);2930#ifdef __cplusplus31} // extern "C"3233namespace __rtsan {34#if defined(__has_feature) && __has_feature(realtime_sanitizer)3536class ScopedDisabler {37public:38ScopedDisabler() { __rtsan_disable(); }39~ScopedDisabler() { __rtsan_enable(); }4041#if __cplusplus >= 201103L42ScopedDisabler(const ScopedDisabler &) = delete;43ScopedDisabler &operator=(const ScopedDisabler &) = delete;44ScopedDisabler(ScopedDisabler &&) = delete;45ScopedDisabler &operator=(ScopedDisabler &&) = delete;46#else47private:48ScopedDisabler(const ScopedDisabler &);49ScopedDisabler &operator=(const ScopedDisabler &);50#endif // __cplusplus >= 201103L51};5253#else5455class ScopedDisabler {56public:57ScopedDisabler() {}58#if __cplusplus >= 201103L59ScopedDisabler(const ScopedDisabler &) = delete;60ScopedDisabler &operator=(const ScopedDisabler &) = delete;61ScopedDisabler(ScopedDisabler &&) = delete;62ScopedDisabler &operator=(ScopedDisabler &&) = delete;63#else64private:65ScopedDisabler(const ScopedDisabler &);66ScopedDisabler &operator=(const ScopedDisabler &);67#endif // __cplusplus >= 201103L68};6970#endif // defined(__has_feature) && __has_feature(realtime_sanitizer)71} // namespace __rtsan72#endif // __cplusplus7374#endif // SANITIZER_RTSAN_INTERFACE_H757677