From 6411bd9877a7a072becb2f7f32c6397bf2f92cd3 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 5 Dec 2012 10:16:17 +0000 Subject: [PATCH] tsan: remove unnecesary include file llvm-svn: 169370 --- compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 35 +++++++++++++++- compiler-rt/lib/tsan/rtl/tsan_interceptors.h | 58 --------------------------- 2 files changed, 34 insertions(+), 59 deletions(-) delete mode 100644 compiler-rt/lib/tsan/rtl/tsan_interceptors.h diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index 55d7565..ccdf963 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -15,7 +15,7 @@ #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_placement_new.h" #include "sanitizer_common/sanitizer_stacktrace.h" -#include "tsan_interceptors.h" +#include "interception/interception.h" #include "tsan_interface.h" #include "tsan_platform.h" #include "tsan_rtl.h" @@ -137,6 +137,15 @@ static SignalContext *SigCtx(ThreadState *thr) { static unsigned g_thread_finalize_key; +class ScopedInterceptor { + public: + ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc); + ~ScopedInterceptor(); + private: + ThreadState *const thr_; + const int in_rtl_; +}; + ScopedInterceptor::ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc) : thr_(thr) @@ -160,6 +169,30 @@ ScopedInterceptor::~ScopedInterceptor() { CHECK_EQ(in_rtl_, thr_->in_rtl); } +#define SCOPED_INTERCEPTOR_RAW(func, ...) \ + ThreadState *thr = cur_thread(); \ + StatInc(thr, StatInterceptor); \ + StatInc(thr, StatInt_##func); \ + const uptr caller_pc = GET_CALLER_PC(); \ + ScopedInterceptor si(thr, #func, caller_pc); \ + /* Subtract one from pc as we need current instruction address */ \ + const uptr pc = __sanitizer::StackTrace::GetCurrentPc() - 1; \ + (void)pc; \ +/**/ + +#define SCOPED_TSAN_INTERCEPTOR(func, ...) \ + SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \ + if (REAL(func) == 0) { \ + Printf("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \ + Die(); \ + } \ + if (thr->in_rtl > 1) \ + return REAL(func)(__VA_ARGS__); \ +/**/ + +#define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__) +#define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func) + #define BLOCK_REAL(name) (BlockingCall(thr), REAL(name)) struct BlockingCall { diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h deleted file mode 100644 index 86fca32..0000000 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h +++ /dev/null @@ -1,58 +0,0 @@ -//===-- tsan_interceptors.h -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file is a part of ThreadSanitizer (TSan), a race detector. -// -//===----------------------------------------------------------------------===// - -#ifndef TSAN_INTERCEPTORS_H -#define TSAN_INTERCEPTORS_H - -#include "interception/interception.h" -#include "sanitizer_common/sanitizer_stacktrace.h" -#include "tsan_rtl.h" - -namespace __tsan { - -class ScopedInterceptor { - public: - ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc); - ~ScopedInterceptor(); - private: - ThreadState *const thr_; - const int in_rtl_; -}; - -#define SCOPED_INTERCEPTOR_RAW(func, ...) \ - ThreadState *thr = cur_thread(); \ - StatInc(thr, StatInterceptor); \ - StatInc(thr, StatInt_##func); \ - const uptr caller_pc = GET_CALLER_PC(); \ - ScopedInterceptor si(thr, #func, caller_pc); \ - /* Subtract one from pc as we need current instruction address */ \ - const uptr pc = __sanitizer::StackTrace::GetCurrentPc() - 1; \ - (void)pc; \ -/**/ - -#define SCOPED_TSAN_INTERCEPTOR(func, ...) \ - SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \ - if (REAL(func) == 0) { \ - Printf("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \ - Die(); \ - } \ - if (thr->in_rtl > 1) \ - return REAL(func)(__VA_ARGS__); \ -/**/ - -#define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__) -#define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func) - -} // namespace __tsan - -#endif // TSAN_INTERCEPTORS_H -- 2.7.4