Avoid is_constant calls in vectorizable_bswap
[official-gcc.git] / libsanitizer / tsan / tsan_interceptors.h
blobde47466501da7097b6052f9331d2eb6e6b8fff54
1 #ifndef TSAN_INTERCEPTORS_H
2 #define TSAN_INTERCEPTORS_H
4 #include "sanitizer_common/sanitizer_stacktrace.h"
5 #include "tsan_rtl.h"
7 namespace __tsan {
9 class ScopedInterceptor {
10 public:
11 ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc);
12 ~ScopedInterceptor();
13 void DisableIgnores();
14 void EnableIgnores();
15 private:
16 ThreadState *const thr_;
17 const uptr pc_;
18 bool in_ignored_lib_;
19 bool ignoring_;
22 LibIgnore *libignore();
24 } // namespace __tsan
26 #define SCOPED_INTERCEPTOR_RAW(func, ...) \
27 ThreadState *thr = cur_thread(); \
28 const uptr caller_pc = GET_CALLER_PC(); \
29 ScopedInterceptor si(thr, #func, caller_pc); \
30 const uptr pc = StackTrace::GetCurrentPc(); \
31 (void)pc; \
32 /**/
34 #define SCOPED_TSAN_INTERCEPTOR(func, ...) \
35 SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \
36 if (REAL(func) == 0) { \
37 Report("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
38 Die(); \
39 } \
40 if (!thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib) \
41 return REAL(func)(__VA_ARGS__); \
42 /**/
44 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START() \
45 si.DisableIgnores();
47 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END() \
48 si.EnableIgnores();
50 #define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
52 #endif // TSAN_INTERCEPTORS_H