Skip to content

Commit be88598

Browse files
committed
Add LLVM 22 availability annotation
1 parent 7fa84f1 commit be88598

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

libcxx/include/__configuration/availability.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
// in all versions of the library are available.
8585
#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
8686

87+
# define _LIBCPP_INTRODUCED_IN_LLVM_22 1
88+
# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */
89+
8790
# define _LIBCPP_INTRODUCED_IN_LLVM_21 1
8891
# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE /* nothing */
8992

@@ -112,6 +115,10 @@
112115

113116
// clang-format off
114117

118+
// LLVM 22
119+
# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
120+
# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
121+
115122
// LLVM 21
116123
// TODO: Fill this in
117124
# define _LIBCPP_INTRODUCED_IN_LLVM_21 0
@@ -291,6 +298,10 @@
291298
#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
292299
// No attribute, since we've had bad_function_call::what() in the headers before
293300

301+
// Controls whether the internal implementation for text_encoding::environment() -> te_impl::__environment() is available
302+
#define _LIBCPP_AVAILABILITY_HAS_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22
303+
#define _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
304+
294305
// Define availability attributes that depend on both
295306
// _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
296307
#if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI

libcxx/include/__text_encoding/te_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,14 @@ struct __te_impl {
531531
_LIBCPP_HIDDEN static __id __get_win32_acp();
532532
# endif
533533

534+
# if _LIBCPP_AVAILABILITY_HAS_TE_ENVIRONMENT
534535
[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI static __te_impl __environment();
535536

536537
template <__id _Id>
537538
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static bool __environment_is() {
538539
return __environment() == _Id;
539540
}
541+
# endif
540542
# endif
541543

542544
const __te_data* __encoding_rep_ = __text_encoding_data + 1;

libcxx/test/libcxx/utilities/text_encoding/environment.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// UNSUPPORTED: no-localization
1515
// UNSUPPORTED: android
1616
// UNSUPPORTED: windows
17+
// UNSUPPORTED: availability-te-environment-missing
1718

1819
#include <algorithm>
1920
#include <cassert>

libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
// UNSUPPORTED: no-localization
1515
// UNSUPPORTED: android
16+
// UNSUPPORTED: availability-te-environment-missing
1617

1718
// class text_encoding
1819

libcxx/utils/libcxx/test/features.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,4 +889,13 @@ def check_gdb(cfg):
889889
cfg.available_features,
890890
),
891891
),
892+
893+
# Tests that require std::text_encoding::environment() in the built library
894+
Feature(
895+
name="availability-te-environment-missing",
896+
when=lambda cfg: BooleanExpression.evaluate(
897+
"!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && !_target-has-llvm-22)",
898+
cfg.available_features,
899+
),
900+
),
892901
]

0 commit comments

Comments
 (0)