[libcxx-commits] [libcxx] [libc++][hardening] Add `_LIBCPP_ASSERT_NON_NULL` to check for null pointers (PR #71428)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 6 23:03:15 PST 2023
================
@@ -320,6 +326,7 @@
// Enabled checks.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message)
----------------
ldionne wrote:
I think it makes sense to start at safe like you're doing because nullptr dereferences are still technically UB and can lead to heisenbugs when the compiler generates code while assuming that a pointer is not null (since you dereferenced it).
https://github.com/llvm/llvm-project/pull/71428
More information about the libcxx-commits
mailing list