[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)

via libc-commits libc-commits at lists.llvm.org
Sat May 31 10:36:27 PDT 2025


================
@@ -9,11 +9,14 @@
 #include "src/string/memrchr.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
 #include <stddef.h>
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) {
+  LIBC_CRASH_ON_NULLPTR(src);
----------------
lntue wrote:

Do we need to check if `n != 0` before checking nullptr?

https://github.com/llvm/llvm-project/pull/116262


More information about the libc-commits mailing list