[libcxx-commits] [libcxx] [libc++][hardening] Add `_LIBCPP_ASSERT_NON_NULL` to check for null pointers (PR #71428)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 7 18:08:15 PST 2023
================
@@ -235,7 +235,7 @@ recursive_directory_iterator::recursive_directory_iterator(
}
void recursive_directory_iterator::__pop(error_code* ec) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "Popping the end iterator");
+ _LIBCPP_ASSERT_NON_NULL(__imp_, "Popping the end iterator");
----------------
var-const wrote:
> I think I would change these few instances to `_LIBCPP_ASSERT_NON_NULL(__imp_ != nullptr, "Popping the end iterator");`
Done.
I think it would be great to make the assertions contain more logic rather than just accepting a boolean, but I'd rather leave this for later.
https://github.com/llvm/llvm-project/pull/71428
More information about the libcxx-commits
mailing list