Skip to content

Commit

Permalink
[Sanitizer] Cleanup {ASAN, MSAN}_INTERCEPT_FUNC[_VER] macro
Browse files Browse the repository at this point in the history
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

llvm-svn: 359466
  • Loading branch information
yln committed Apr 29, 2019
1 parent 8c3513f commit 1f10f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions compiler-rt/lib/asan/asan_interceptors.h
Expand Up @@ -123,15 +123,13 @@ DECLARE_REAL(char*, strstr, const char *s1, const char *s2)
#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)
Expand Down
5 changes: 2 additions & 3 deletions compiler-rt/lib/msan/msan_interceptors.cc
Expand Up @@ -1244,16 +1244,15 @@ 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)

#define MSAN_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, "MemorySanitizer: failed to intercept '" #name "@@" #ver "'\n"); \
} while (0)
Expand Down

0 comments on commit 1f10f6e

Please sign in to comment.