[libcxx-commits] [PATCH] D134060: [NFC][libc++][format] Uses ranges algorithm.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 20 09:59:57 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c932cdb10fe: [NFC][libc++][format] Uses ranges algorithm. (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134060/new/

https://reviews.llvm.org/D134060

Files:
  libcxx/include/__format/extended_grapheme_cluster_table.h
  libcxx/utils/generate_extended_grapheme_cluster_table.py


Index: libcxx/utils/generate_extended_grapheme_cluster_table.py
===================================================================
--- libcxx/utils/generate_extended_grapheme_cluster_table.py
+++ libcxx/utils/generate_extended_grapheme_cluster_table.py
@@ -117,8 +117,6 @@
 
 /// Returns the extended grapheme cluster bondary property of a code point.
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept {{
-  // TODO FMT use std::ranges::upper_bound.
-
   // The algorithm searches for the upper bound of the range and, when found,
   // steps back one entry. This algorithm is used since the code point can be
   // anywhere in the range. After a lower bound is found the next step is to
@@ -135,7 +133,7 @@
   // size. Then the upper bound for code point 3 will return the entry after
   // 0x1810. After moving to the previous entry the algorithm arrives at the
   // correct entry.
-  ptrdiff_t __i = std::upper_bound(__entries, std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
+  ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
   if (__i == 0)
     return __property::__none;
 
@@ -212,7 +210,7 @@
 #ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
 #define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
 
-#include <__algorithm/upper_bound.h>
+#include <__algorithm/ranges_upper_bound.h>
 #include <__config>
 #include <__iterator/access.h>
 #include <cstddef>
Index: libcxx/include/__format/extended_grapheme_cluster_table.h
===================================================================
--- libcxx/include/__format/extended_grapheme_cluster_table.h
+++ libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -61,7 +61,7 @@
 #ifndef _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
 #define _LIBCPP___FORMAT_EXTENDED_GRAPHEME_CLUSTER_TABLE_H
 
-#include <__algorithm/upper_bound.h>
+#include <__algorithm/ranges_upper_bound.h>
 #include <__config>
 #include <__iterator/access.h>
 #include <cstddef>
@@ -1608,8 +1608,6 @@
 
 /// Returns the extended grapheme cluster bondary property of a code point.
 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __property __get_property(const char32_t __code_point) noexcept {
-  // TODO FMT use std::ranges::upper_bound.
-
   // The algorithm searches for the upper bound of the range and, when found,
   // steps back one entry. This algorithm is used since the code point can be
   // anywhere in the range. After a lower bound is found the next step is to
@@ -1626,7 +1624,7 @@
   // size. Then the upper bound for code point 3 will return the entry after
   // 0x1810. After moving to the previous entry the algorithm arrives at the
   // correct entry.
-  ptrdiff_t __i = std::upper_bound(__entries, std::end(__entries), (__code_point << 11) | 0x7ffu) - __entries;
+  ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 11) | 0x7ffu) - __entries;
   if (__i == 0)
     return __property::__none;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134060.461603.patch
Type: text/x-patch
Size: 3018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220920/cae04be5/attachment-0001.bin>


More information about the libcxx-commits mailing list