Skip to content

[libc++][format] Adds ABI tags to inline constexpr variables. #86293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,12 @@ typedef __char32_t char32_t;
// the implementation of a virtual function in an ABI-incompatible way in the first place,
// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable.
//
// The macro can be applied to record and enum types. When the tagged type is nested in
// a record this "parent" record needs to have the macro too. Another use case for applying
// this macro to records and unions is to apply an ABI tag to inline constexpr variables.
// This can be useful for inline variables that are implementation details which are expected
// to change in the future.
//
// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
// the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
// use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__format/escaped_output_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace __escaped_output_table {
/// - bits [0, 10] The size of the range, allowing 2048 elements.
/// - bits [11, 31] The lower bound code point of the range. The upper bound of
/// the range is lower bound + size.
inline constexpr uint32_t __entries[893] = {
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[893] = {
0x00000020,
0x0003f821,
0x00056800,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ enum class __property : uint8_t {
/// following benchmark.
/// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
// clang-format off
inline constexpr uint32_t __entries[1496] = {
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[1496] = {
0x00000091,
0x00005005,
0x00005811,
Expand Down
3 changes: 1 addition & 2 deletions libcxx/include/__format/parser_std_format_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr uint32_t __substitute_arg_id(basic_format_arg<_C
///
/// They default to false so when a new field is added it needs to be opted in
/// explicitly.
// TODO FMT Use an ABI tag for this struct.
struct __fields {
struct _LIBCPP_HIDE_FROM_ABI __fields {
uint16_t __sign_ : 1 {false};
uint16_t __alternate_form_ : 1 {false};
uint16_t __zero_padding_ : 1 {false};
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__format/width_estimation_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace __width_estimation_table {
/// - bits [0, 13] The size of the range, allowing 16384 elements.
/// - bits [14, 31] The lower bound code point of the range. The upper bound of
/// the range is lower bound + size.
inline constexpr uint32_t __entries[108] = {
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[108] = {
0x0440005f /* 00001100 - 0000115f [ 96] */, //
0x08c68001 /* 0000231a - 0000231b [ 2] */, //
0x08ca4001 /* 00002329 - 0000232a [ 2] */, //
Expand Down
2 changes: 1 addition & 1 deletion libcxx/utils/generate_escaped_output_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
/// - bits [0, 10] The size of the range, allowing 2048 elements.
/// - bits [11, 31] The lower bound code point of the range. The upper bound of
/// the range is lower bound + size.
inline constexpr uint32_t __entries[{size}] = {{
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[{size}] = {{
{entries}}};

/// At the end of the valid Unicode code points space a lot of code points are
Expand Down
2 changes: 1 addition & 1 deletion libcxx/utils/generate_extended_grapheme_cluster_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
/// following benchmark.
/// libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
// clang-format off
inline constexpr uint32_t __entries[{size}] = {{
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[{size}] = {{
{entries}}};
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion libcxx/utils/generate_width_estimation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
/// - bits [0, 13] The size of the range, allowing 16384 elements.
/// - bits [14, 31] The lower bound code point of the range. The upper bound of
/// the range is lower bound + size.
inline constexpr uint32_t __entries[{size}] = {{
_LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[{size}] = {{
{entries}}};

/// The upper bound entry of EastAsianWidth.txt.
Expand Down