[libcxx-commits] [libcxx] [libc++] Inline `text_encoding` alias offset table std::count to 884 (PR #207471)
William Tran-Viet via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 5 11:46:30 PDT 2026
================
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <text_encoding>
+
+// REQUIRES: std-at-least-c++26
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=40000000
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=1000000000
+
+// Our table has 882 aliases exactly, test to make sure that number matches with the total alias count
+// Internally, there are 884 entries with 2 reserved for id::unknown and id::other
+#include <cassert>
+#include <ranges>
+#include <text_encoding>
+
+#include "test_text_encoding.h"
+
+constexpr bool test() {
+ long long sum = 0;
+ for (auto& enc : unique_encoding_data) {
+ std::text_encoding te{std::text_encoding::id(enc.mib)};
+
+ sum += std::ranges::size(te.aliases());
+ }
+
+ assert(sum == 882);
----------------
smallp-o-p wrote:
I assume that `_LIBCPP_HIDE_FROM_ABI` is implicitly (thanks to the change to `_LIBCPP_BEGIN/END_NAMESPACE_STD`) added to the tables in the header, so they shouldn't be a part of the ABI.
https://github.com/llvm/llvm-project/pull/207471
More information about the libcxx-commits
mailing list