[libc++] Add availability markup for LLVM 19 and LLVM 20 (#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.
This commit is contained in:
Louis Dionne
2025-11-02 17:24:30 -08:00
committed by GitHub
parent 4eed68357e
commit 3252e11da3
11 changed files with 80 additions and 27 deletions

View File

@@ -118,14 +118,40 @@
# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE __attribute__((unavailable))
// LLVM 20
// TODO: Fill this in
# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE __attribute__((unavailable))
//
// Note that versions for most Apple OSes were bumped forward and aligned in that release.
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \
(defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000)
# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
# else
# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
# endif
# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE \
__attribute__((availability(macos, strict, introduced = 26.0))) \
__attribute__((availability(ios, strict, introduced = 26.0))) \
__attribute__((availability(tvos, strict, introduced = 26.0))) \
__attribute__((availability(watchos, strict, introduced = 26.0))) \
__attribute__((availability(bridgeos, strict, introduced = 10.0)))
// LLVM 19
// TODO: Fill this in
# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \
(defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400)
# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
# else
# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
# endif
# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE \
__attribute__((availability(macos, strict, introduced = 15.4))) \
__attribute__((availability(ios, strict, introduced = 18.4))) \
__attribute__((availability(tvos, strict, introduced = 18.4))) \
__attribute__((availability(watchos, strict, introduced = 11.4))) \
__attribute__((availability(bridgeos, strict, introduced = 9.4)))
// LLVM 18
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \

View File

@@ -10,8 +10,7 @@
// The fix for issue 57964 requires an updated dylib due to explicit
// instantiations. That means Apple backdeployment targets remain broken.
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
// XFAIL: using-built-library-before-llvm-19 && !darwin
// XFAIL: using-built-library-before-llvm-19
// <ios>

View File

@@ -12,8 +12,7 @@
// This test requires the fix to https://llvm.org/PR60509 in the dylib,
// which landed in 5afb937d8a30445642ccaf33866ee4cdd0713222.
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
// XFAIL: using-built-library-before-llvm-19 && !darwin
// XFAIL: using-built-library-before-llvm-19
#include <fstream>
#include <cstddef>

View File

@@ -13,8 +13,7 @@
// The fix for bug 51497 and bug 51499 require and updated dylib due to
// explicit instantiations. That means Apple backdeployment targets remain
// broken.
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
// XFAIL: using-built-library-before-llvm-19 && !darwin
// XFAIL: using-built-library-before-llvm-19
#include <istream>
#include <cassert>

View File

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

View File

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

View File

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

View File

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

View File

@@ -733,17 +733,45 @@ DEFAULT_FEATURES += [
# Helpers to define correspondances between LLVM versions and vendor system versions.
# Those are used for backdeployment features below, do not use directly in tests.
DEFAULT_FEATURES += [
Feature(
name="_target-has-llvm-22",
when=lambda cfg: BooleanExpression.evaluate(
"TBD",
cfg.available_features,
),
),
Feature(
name="_target-has-llvm-21",
when=lambda cfg: BooleanExpression.evaluate(
"TBD",
cfg.available_features,
),
),
Feature(
name="_target-has-llvm-20",
when=lambda cfg: BooleanExpression.evaluate(
"_target-has-llvm-21 || target={{.+}}-apple-macosx{{26.[0-9](.\d+)?}}",
cfg.available_features,
),
),
Feature(
name="_target-has-llvm-19",
when=lambda cfg: BooleanExpression.evaluate(
"_target-has-llvm-20 || target={{.+}}-apple-macosx{{15.[4-9](.\d+)?}}",
cfg.available_features,
),
),
Feature(
name="_target-has-llvm-18",
when=lambda cfg: BooleanExpression.evaluate(
"target={{.+}}-apple-macosx{{15(.[0-9]+)?(.[0-9]+)?}}",
"_target-has-llvm-19 || target={{.+}}-apple-macosx{{15.[0-3](.\d+)?}}",
cfg.available_features,
),
),
Feature(
name="_target-has-llvm-17",
when=lambda cfg: BooleanExpression.evaluate(
"_target-has-llvm-18 || target={{.+}}-apple-macosx{{14.[4-9](.[0-9]+)?}} || target={{.+}}-apple-macosx{{1[5-9]([.].+)?}}",
"_target-has-llvm-18 || target={{.+}}-apple-macosx{{14.[4-9](.\d+)?}}",
cfg.available_features,
),
),
@@ -821,7 +849,7 @@ DEFAULT_FEATURES += [
# a libc++ flavor that enables availability markup. Similarly, a test could fail when
# run against the system library of an older version of FreeBSD, even though FreeBSD
# doesn't provide availability markup at the time of writing this.
for version in ("12", "13", "14", "15", "16", "17", "18", "19", "20"):
for version in ("12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22"):
DEFAULT_FEATURES.append(
Feature(
name="using-built-library-before-llvm-{}".format(version),

View File

@@ -13,6 +13,10 @@
// dd8b266ef.
// UNSUPPORTED: using-built-library-before-llvm-20
// This test exercises support for BitInt demangling introduced in
// 20f56d140909a01c74e9981835373eaab6021af9.
// UNSUPPORTED: using-built-library-before-llvm-21
// XFAIL: win32-broken-printf-a-precision
#include "support/timer.h"

View File

@@ -15,8 +15,7 @@
// to undefined symbols when linking against a libc++ that re-exports the symbols,
// but running against a libc++ that doesn't. Fortunately, usage of __cxa_uncaught_exception()
// in the wild seems to be close to non-existent.
// TODO: Remove && !darwin once availability markup for LLVM 19 on macOS has been added
// XFAIL: using-built-library-before-llvm-19 && !darwin
// XFAIL: using-built-library-before-llvm-19
#include <cxxabi.h>
#include <cassert>