Skip to content

Commit 7eba77c

Browse files
ldionneDebadri Basak
authored andcommitted
[libc++] Add availability markup for LLVM 19 and LLVM 20 (llvm#140072)
An LLVM 19-aligned libc++ was released with macOS 15.4 (and corresponding OSes), and LLVM-20 aligned with macOS 26.0. This patch adds availability markup to reflect that.
1 parent e17f72f commit 7eba77c

File tree

11 files changed

+80
-27
lines changed

11 files changed

+80
-27
lines changed

libcxx/include/__configuration/availability.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,40 @@
118118
# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE __attribute__((unavailable))
119119

120120
// LLVM 20
121-
// TODO: Fill this in
122-
# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
123-
# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE __attribute__((unavailable))
121+
//
122+
// Note that versions for most Apple OSes were bumped forward and aligned in that release.
123+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260000) || \
124+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \
125+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \
126+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \
127+
(defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000)
128+
# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
129+
# else
130+
# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
131+
# endif
132+
# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE \
133+
__attribute__((availability(macos, strict, introduced = 26.0))) \
134+
__attribute__((availability(ios, strict, introduced = 26.0))) \
135+
__attribute__((availability(tvos, strict, introduced = 26.0))) \
136+
__attribute__((availability(watchos, strict, introduced = 26.0))) \
137+
__attribute__((availability(bridgeos, strict, introduced = 10.0)))
124138

125139
// LLVM 19
126-
// TODO: Fill this in
127-
# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
128-
# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
140+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \
141+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \
142+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \
143+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \
144+
(defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400)
145+
# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
146+
# else
147+
# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
148+
# endif
149+
# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE \
150+
__attribute__((availability(macos, strict, introduced = 15.4))) \
151+
__attribute__((availability(ios, strict, introduced = 18.4))) \
152+
__attribute__((availability(tvos, strict, introduced = 18.4))) \
153+
__attribute__((availability(watchos, strict, introduced = 11.4))) \
154+
__attribute__((availability(bridgeos, strict, introduced = 9.4)))
129155

130156
// LLVM 18
131157
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \

libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
// The fix for issue 57964 requires an updated dylib due to explicit
1212
// instantiations. That means Apple backdeployment targets remain broken.
13-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
14-
// XFAIL: using-built-library-before-llvm-19 && !darwin
13+
// XFAIL: using-built-library-before-llvm-19
1514

1615
// <ios>
1716

libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/setbuf.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
// This test requires the fix to https://llvm.org/PR60509 in the dylib,
1414
// which landed in 5afb937d8a30445642ccaf33866ee4cdd0713222.
15-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
16-
// XFAIL: using-built-library-before-llvm-19 && !darwin
15+
// XFAIL: using-built-library-before-llvm-19
1716

1817
#include <fstream>
1918
#include <cstddef>

libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
// The fix for bug 51497 and bug 51499 require and updated dylib due to
1414
// explicit instantiations. That means Apple backdeployment targets remain
1515
// broken.
16-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
17-
// XFAIL: using-built-library-before-llvm-19 && !darwin
16+
// XFAIL: using-built-library-before-llvm-19
1817

1918
#include <istream>
2019
#include <cassert>

libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed behavior of
1010
// FP parsing. This requires 3e15c97fa3812993bdc319827a5c6d867b765ae8 in the dylib.
11-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
12-
// XFAIL: using-built-library-before-llvm-19 && !darwin
11+
// XFAIL: using-built-library-before-llvm-19
1312

1413
// <locale>
1514

libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed behavior of
1010
// FP parsing. This requires 3e15c97fa3812993bdc319827a5c6d867b765ae8 in the dylib.
11-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
12-
// XFAIL: using-built-library-before-llvm-19 && !darwin
11+
// XFAIL: using-built-library-before-llvm-19
1312

1413
// <locale>
1514

libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed behavior of
1010
// FP parsing. This requires 3e15c97fa3812993bdc319827a5c6d867b765ae8 in the dylib.
11-
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
12-
// XFAIL: using-built-library-before-llvm-19 && !darwin
11+
// XFAIL: using-built-library-before-llvm-19
1312

1413
// <locale>
1514

libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
// UNSUPPORTED: no-exceptions
1010

11-
// After changing the alignment of the allocated pointer from 16 to 8, the exception
12-
// thrown is no longer `bad_alloc` but instead length_error on systems using new
13-
// headers but a dylib that doesn't contain 04ce0ba.
11+
// This test fails when using a built library that does not contain
12+
// 15860446a8c3, which changed the return value of max_size(). Without
13+
// that change, the built library believes the max size to be one greater
14+
// than it really is, and we fail to throw `length_error` from `string::resize()`,
15+
// which is explicitly instantiated in the built library.
1416
//
15-
// XFAIL: using-built-library-before-llvm-19
17+
// XFAIL: using-built-library-before-llvm-21
1618

1719
// <string>
1820

libcxx/utils/libcxx/test/features.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,17 +733,45 @@ def check_gdb(cfg):
733733
# Helpers to define correspondances between LLVM versions and vendor system versions.
734734
# Those are used for backdeployment features below, do not use directly in tests.
735735
DEFAULT_FEATURES += [
736+
Feature(
737+
name="_target-has-llvm-22",
738+
when=lambda cfg: BooleanExpression.evaluate(
739+
"TBD",
740+
cfg.available_features,
741+
),
742+
),
743+
Feature(
744+
name="_target-has-llvm-21",
745+
when=lambda cfg: BooleanExpression.evaluate(
746+
"TBD",
747+
cfg.available_features,
748+
),
749+
),
750+
Feature(
751+
name="_target-has-llvm-20",
752+
when=lambda cfg: BooleanExpression.evaluate(
753+
"_target-has-llvm-21 || target={{.+}}-apple-macosx{{26.[0-9](.\d+)?}}",
754+
cfg.available_features,
755+
),
756+
),
757+
Feature(
758+
name="_target-has-llvm-19",
759+
when=lambda cfg: BooleanExpression.evaluate(
760+
"_target-has-llvm-20 || target={{.+}}-apple-macosx{{15.[4-9](.\d+)?}}",
761+
cfg.available_features,
762+
),
763+
),
736764
Feature(
737765
name="_target-has-llvm-18",
738766
when=lambda cfg: BooleanExpression.evaluate(
739-
"target={{.+}}-apple-macosx{{15(.[0-9]+)?(.[0-9]+)?}}",
767+
"_target-has-llvm-19 || target={{.+}}-apple-macosx{{15.[0-3](.\d+)?}}",
740768
cfg.available_features,
741769
),
742770
),
743771
Feature(
744772
name="_target-has-llvm-17",
745773
when=lambda cfg: BooleanExpression.evaluate(
746-
"_target-has-llvm-18 || target={{.+}}-apple-macosx{{14.[4-9](.[0-9]+)?}} || target={{.+}}-apple-macosx{{1[5-9]([.].+)?}}",
774+
"_target-has-llvm-18 || target={{.+}}-apple-macosx{{14.[4-9](.\d+)?}}",
747775
cfg.available_features,
748776
),
749777
),
@@ -821,7 +849,7 @@ def check_gdb(cfg):
821849
# a libc++ flavor that enables availability markup. Similarly, a test could fail when
822850
# run against the system library of an older version of FreeBSD, even though FreeBSD
823851
# doesn't provide availability markup at the time of writing this.
824-
for version in ("12", "13", "14", "15", "16", "17", "18", "19", "20"):
852+
for version in ("12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22"):
825853
DEFAULT_FEATURES.append(
826854
Feature(
827855
name="using-built-library-before-llvm-{}".format(version),

libcxxabi/test/test_demangle.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// dd8b266ef.
1414
// UNSUPPORTED: using-built-library-before-llvm-20
1515

16+
// This test exercises support for BitInt demangling introduced in
17+
// 20f56d140909a01c74e9981835373eaab6021af9.
18+
// UNSUPPORTED: using-built-library-before-llvm-21
19+
1620
// XFAIL: win32-broken-printf-a-precision
1721

1822
#include "support/timer.h"

0 commit comments

Comments
 (0)