[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:37:23 PDT 2025


================
@@ -9,11 +9,13 @@
 #include "src/string/memset.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
 #include "src/string/memory_utils/inline_memset.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(void *, memset, (void *dst, int value, size_t count)) {
+  LIBC_CRASH_ON_NULLPTR(dst);
----------------
lntue wrote:

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

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


More information about the libc-commits mailing list