[compiler-rt] r359466 - [Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 09:39:18 PDT 2019


Author: yln
Date: Mon Apr 29 09:39:18 2019
New Revision: 359466

URL: http://llvm.org/viewvc/llvm-project?rev=359466&view=rev
Log:
[Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro

Note that this change is not strictly NFC since we add the
`(&(name) != &WRAP(name)` part to the conditional for the `_VER` variant
of the macro.

Reviewers: vitalybuka

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

Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.h
    compiler-rt/trunk/lib/msan/msan_interceptors.cc

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=359466&r1=359465&r2=359466&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Mon Apr 29 09:39:18 2019
@@ -123,15 +123,13 @@ DECLARE_REAL(char*, strstr, const char *
 #define ASAN_INTERCEPT_FUNC(name)                                        \
   do {                                                                   \
     INTERCEPT_FUNCTION(name);                                            \
-    bool same = (& (name) == & WRAP(name));                              \
-    if ((!same || !REAL(name)))                                          \
+    if (&(name) != &WRAP(name) || !REAL(name))                           \
       VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 #define ASAN_INTERCEPT_FUNC_VER(name, ver)                                     \
   do {                                                                         \
     INTERCEPT_FUNCTION_VER(name, ver);                                         \
-    name##_type ptr = (::__interception::real_##name);                         \
-    if ((!ptr || !REAL(name)))                                                 \
+    if (&(name) != &WRAP(name) || !REAL(name))                                 \
       VReport(                                                                 \
           1, "AddressSanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)

Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=359466&r1=359465&r2=359466&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Mon Apr 29 09:39:18 2019
@@ -1244,8 +1244,7 @@ int OnExit() {
 #define MSAN_INTERCEPT_FUNC(name)                                       \
   do {                                                                  \
     INTERCEPT_FUNCTION(name);                                           \
-    bool same = (& (name) == & WRAP(name));                             \
-    if ((!same || !REAL(name)))                                         \
+    if (&(name) != &WRAP(name) || !REAL(name))                          \
       VReport(1, "MemorySanitizer: failed to intercept '" #name "'\n"); \
   } while (0)
 
@@ -1253,7 +1252,7 @@ int OnExit() {
   do {                                                                        \
     INTERCEPT_FUNCTION_VER(name, ver);                                        \
     name##_type ptr = (::__interception::real_##name);                        \
-    if ((!ptr || !REAL(name)))                                                \
+    if (&(name) != &WRAP(name) || !REAL(name))                                \
       VReport(                                                                \
           1, "MemorySanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
   } while (0)




More information about the llvm-commits mailing list