You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/docs/RealtimeSanitizer.rst
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,3 +83,53 @@ non-zero exit code.
83
83
#13 0x00010230dd64 in main main.cpp:9
84
84
#14 0x0001958960dc (<unknown module>)
85
85
#15 0x2f557ffffffffffc (<unknown module>)
86
+
87
+
Disabling
88
+
---------
89
+
90
+
In some circumstances, you may want to suppress error reporting in a specific scope.
91
+
92
+
In C++, this is achieved via ``__rtsan::ScopedDisabler``. Within the scope where the ``ScopedDisabler`` object is instantiated, all sanitizer error reports are suppressed. This suppression applies to the current scope as well as all invoked functions, including any functions called transitively.
If RealtimeSanitizer is not enabled at compile time (i.e., the code is not compiled with the ``-fsanitize=realtime`` flag), the ``ScopedDisabler`` is compiled as a no-op.
106
+
107
+
In C, you can use the ``__rtsan_disable()`` and ``rtsan_enable()`` functions to manually disable and re-enable RealtimeSanitizer checks.
108
+
109
+
.. code-block:: c++
110
+
111
+
#include <sanitizer/rtsan_interface.h>
112
+
113
+
int process(const float* buffer) [[clang::nonblocking]]
114
+
{
115
+
{
116
+
__rtsan_disable();
117
+
118
+
...
119
+
120
+
__rtsan_enable();
121
+
}
122
+
}
123
+
124
+
Each call to ``__rtsan_disable()`` must be paired with a subsequent call to ``__rtsan_enable()`` to restore normal sanitizer functionality. If a corresponding ``rtsan_enable()`` call is not made, the behavior is undefined.
125
+
126
+
Compile-time sanitizer detection
127
+
--------------------------------
128
+
129
+
Clang provides the pre-processor macro ``__has_feature`` which may be used to detect if RealtimeSanitizer is enabled at compile-time.
0 commit comments