[libcxx-commits] [PATCH] D122395: [libc++] Audit all uses of _LIBCPP_ASSERT and _LIBCPP_DEBUG_ASSERT

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 24 06:18:19 PDT 2022


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

I audited all uses of _LIBCPP_ASSERT to make sure that we only used it
for "basic assertions", i.e. assertions with constant-time conditions.
I also audited all uses of _LIBCPP_DEBUG_ASSERT to make sure we used it
only for debug-mode assertions, and in one case had to change for
_LIBCPP_ASSERT instead.

As a fly-by, I also changed a couple of tests against nullptr or 0 to
be more explicit.

After this patch, all uses of _LIBCPP_ASSERT should be with constant-time
conditions, and all uses of _LIBCPP_DEBUG_ASSERT should be with conditions
that we only want to check when the debug mode is enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122395

Files:
  libcxx/include/__hash_table
  libcxx/include/__memory/construct_at.h
  libcxx/include/list
  libcxx/include/unordered_set
  libcxx/src/filesystem/filesystem_common.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122395.417904.patch
Type: text/x-patch
Size: 8049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220324/b1ae2279/attachment.bin>


More information about the libcxx-commits mailing list