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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Feb 10 10:48:28 PST 2025


================
@@ -19,6 +20,8 @@ namespace LIBC_NAMESPACE_DECL {
 template <typename Comp>
 LIBC_INLINE constexpr char *inline_strstr(const char *haystack,
                                           const char *needle, Comp &&comp) {
+  LIBC_CRASH_ON_NULLPTR(haystack);
+  LIBC_CRASH_ON_NULLPTR(needle);
----------------
nickdesaulniers wrote:

I prefer to have the checks on the entry points.  Let's assume users may pass in nullptr to entrypoints; perhaps our internal code can assume better (famous last words).

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


More information about the libc-commits mailing list