[compiler-rt] 6a0f392 - [asan] Avoid -Wtautological-pointer-compare (#164918)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 23 17:59:37 PDT 2025


Author: Thurston Dang
Date: 2025-10-24T00:59:32Z
New Revision: 6a0f392bb50d890f13cb961a911be28f965ed4f2

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

LOG: [asan] Avoid -Wtautological-pointer-compare (#164918)

https://github.com/llvm/llvm-project/pull/164906 converted a
-Wpointer-bool-conversion warning into a -Wtautological-pointer-compare
warning. Avoid both by using the bool cast.

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_interceptors.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index c43332cbc276d..8643271e89d70 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -58,7 +58,7 @@ namespace __asan {
 
 static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
 #if SANITIZER_INTERCEPT_STRNLEN
-  if (REAL(strnlen) != nullptr)
+  if (static_cast<bool>(REAL(strnlen)))
     return REAL(strnlen)(s, maxlen);
 #  endif
   return internal_strnlen(s, maxlen);
@@ -66,7 +66,7 @@ static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
 
 static inline uptr MaybeRealWcsnlen(const wchar_t* s, uptr maxlen) {
 #  if SANITIZER_INTERCEPT_WCSNLEN
-  if (REAL(wcsnlen) != nullptr)
+  if (static_cast<bool>(REAL(wcsnlen)))
     return REAL(wcsnlen)(s, maxlen);
 #  endif
   return internal_wcsnlen(s, maxlen);


        


More information about the llvm-commits mailing list