[compiler-rt] abdefea - tsan: tidy up SCOPED_INTERCEPTOR_RAW

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 26 23:47:50 PDT 2021


Author: Dmitry Vyukov
Date: 2021-10-27T08:47:46+02:00
New Revision: abdefea6a21a26748d4237b70b3f78f29143291b

URL: https://github.com/llvm/llvm-project/commit/abdefea6a21a26748d4237b70b3f78f29143291b
DIFF: https://github.com/llvm/llvm-project/commit/abdefea6a21a26748d4237b70b3f78f29143291b.diff

LOG: tsan: tidy up SCOPED_INTERCEPTOR_RAW

Don't leak caller_pc var from the macro
(it's not supposed to be used by interceptors).
Use UNUSED instead of (void) cast.

Depends on D112540.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112541

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_interceptors.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
index a7728549c999..3886a30cd88d 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h
@@ -38,12 +38,10 @@ inline bool in_symbolizer() {
 
 }  // namespace __tsan
 
-#define SCOPED_INTERCEPTOR_RAW(func, ...)      \
-  ThreadState *thr = cur_thread_init();        \
-  const uptr caller_pc = GET_CALLER_PC();      \
-  ScopedInterceptor si(thr, #func, caller_pc); \
-  const uptr pc = GET_CURRENT_PC();            \
-  (void)pc;
+#define SCOPED_INTERCEPTOR_RAW(func, ...)            \
+  ThreadState *thr = cur_thread_init();              \
+  ScopedInterceptor si(thr, #func, GET_CALLER_PC()); \
+  UNUSED const uptr pc = GET_CURRENT_PC();
 
 #define SCOPED_TSAN_INTERCEPTOR(func, ...)                                \
   SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__);                              \


        


More information about the llvm-commits mailing list