[all-commits] [llvm/llvm-project] cd0ad4: [libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT...

Konstantin Varlamov via All-commits all-commits at lists.llvm.org
Wed Jun 28 15:10:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd0ad4216cb962f160b1b0054df6f72ce6f9f766
      https://github.com/llvm/llvm-project/commit/cd0ad4216cb962f160b1b0054df6f72ce6f9f766
  Author: varconst <varconsteq at gmail.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

  Changed paths:
    M libcxx/include/__algorithm/clamp.h
    M libcxx/include/__algorithm/pop_heap.h
    M libcxx/include/__algorithm/ranges_clamp.h
    M libcxx/include/__algorithm/ranges_max.h
    M libcxx/include/__algorithm/ranges_min.h
    M libcxx/include/__algorithm/ranges_minmax.h
    M libcxx/include/__algorithm/sample.h
    M libcxx/include/__algorithm/sift_down.h
    M libcxx/include/__algorithm/sort.h
    M libcxx/include/__assert
    M libcxx/include/__bit/bit_ceil.h
    M libcxx/include/__charconv/from_chars_integral.h
    M libcxx/include/__charconv/to_chars_base_10.h
    M libcxx/include/__charconv/to_chars_integral.h
    M libcxx/include/__charconv/traits.h
    M libcxx/include/__chrono/parser_std_format_spec.h
    M libcxx/include/__coroutine/coroutine_handle.h
    M libcxx/include/__debug_utils/strict_weak_ordering_check.h
    M libcxx/include/__expected/expected.h
    M libcxx/include/__filesystem/directory_iterator.h
    M libcxx/include/__filesystem/path_iterator.h
    M libcxx/include/__format/buffer.h
    M libcxx/include/__format/format_arg.h
    M libcxx/include/__format/format_string.h
    M libcxx/include/__format/formatter_bool.h
    M libcxx/include/__format/formatter_floating_point.h
    M libcxx/include/__format/formatter_integral.h
    M libcxx/include/__format/formatter_output.h
    M libcxx/include/__format/formatter_string.h
    M libcxx/include/__format/parser_std_format_spec.h
    M libcxx/include/__format/range_formatter.h
    M libcxx/include/__format/unicode.h
    M libcxx/include/__functional/function.h
    M libcxx/include/__hash_table
    M libcxx/include/__iterator/advance.h
    M libcxx/include/__iterator/bounded_iter.h
    M libcxx/include/__iterator/common_iterator.h
    M libcxx/include/__iterator/counted_iterator.h
    M libcxx/include/__iterator/next.h
    M libcxx/include/__iterator/prev.h
    M libcxx/include/__mdspan/extents.h
    M libcxx/include/__memory/assume_aligned.h
    M libcxx/include/__memory/construct_at.h
    M libcxx/include/__memory_resource/polymorphic_allocator.h
    M libcxx/include/__node_handle
    M libcxx/include/__numeric/gcd_lcm.h
    M libcxx/include/__pstl/internal/algorithm_impl.h
    M libcxx/include/__pstl/internal/numeric_impl.h
    M libcxx/include/__pstl/internal/parallel_backend_tbb.h
    M libcxx/include/__pstl/internal/parallel_backend_utils.h
    M libcxx/include/__random/negative_binomial_distribution.h
    M libcxx/include/__ranges/drop_view.h
    M libcxx/include/__ranges/drop_while_view.h
    M libcxx/include/__ranges/filter_view.h
    M libcxx/include/__ranges/iota_view.h
    M libcxx/include/__ranges/lazy_split_view.h
    M libcxx/include/__ranges/subrange.h
    M libcxx/include/__ranges/take_view.h
    M libcxx/include/__ranges/view_interface.h
    M libcxx/include/__stop_token/intrusive_list_view.h
    M libcxx/include/__stop_token/stop_state.h
    M libcxx/include/__string/char_traits.h
    M libcxx/include/__thread/thread.h
    M libcxx/include/__tree
    M libcxx/include/__utility/exception_guard.h
    M libcxx/include/__utility/is_pointer_in_range.h
    M libcxx/include/__utility/unreachable.h
    M libcxx/include/array
    M libcxx/include/deque
    M libcxx/include/experimental/memory_resource
    M libcxx/include/fstream
    M libcxx/include/future
    M libcxx/include/list
    M libcxx/include/locale
    M libcxx/include/map
    M libcxx/include/optional
    M libcxx/include/regex
    M libcxx/include/set
    M libcxx/include/span
    M libcxx/include/string
    M libcxx/include/string_view
    M libcxx/include/unordered_map
    M libcxx/include/unordered_set
    M libcxx/include/vector
    M libcxx/src/filesystem/directory_iterator.cpp
    M libcxx/src/filesystem/error.h
    M libcxx/src/filesystem/format_string.h
    M libcxx/src/filesystem/operations.cpp
    M libcxx/src/filesystem/posix_compat.h
    M libcxx/src/include/ryu/common.h
    M libcxx/src/include/ryu/d2s_intrinsics.h
    M libcxx/src/include/to_chars_floating_point.h
    M libcxx/src/memory_resource.cpp
    M libcxx/src/mutex.cpp
    M libcxx/src/ryu/d2fixed.cpp
    M libcxx/src/ryu/d2s.cpp
    M libcxx/src/ryu/f2s.cpp
    M libcxx/src/string.cpp
    M libcxx/src/strstream.cpp
    M libcxx/src/support/ibm/xlocale_zos.cpp
    M libcxx/src/system_error.cpp

  Log Message:
  -----------
  [libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.

Replace most uses of `_LIBCPP_ASSERT` with
`_LIBCPP_ASSERT_UNCATEGORIZED`.

This is done as a prerequisite to introducing hardened mode to libc++.
The idea is to make enabling assertions an opt-in with (somewhat)
fine-grained controls over which categories of assertions are enabled.
The vast majority of assertions are currently uncategorized; the new
macro will allow turning on `_LIBCPP_ASSERT` (the underlying mechanism
for all kinds of assertions) without enabling all the uncategorized
assertions (in the future; this patch preserves the current behavior).

Differential Revision: https://reviews.llvm.org/D153816




More information about the All-commits mailing list