-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Upstream visionOS Availability & DarwinSDKInfo APIs (#84279)
Admittedly a bit awkward, `visionos` is the correct and accepted spelling for annotating availability for xrOS target triples. This patch detects errors and handles cases when `xros` is mistakenly passed. In addition, add APIs for introduced/deprecated/obsoleted versioning in DarwinSDKInfo mappings.
- Loading branch information
1 parent
143afb4
commit 9cf9cb2
Showing
7 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: %clang_cc1 -triple arm64-apple-xros1 -emit-llvm -o - %s 2>&1 | FileCheck %s | ||
|
||
__attribute__((availability(visionOS, introduced=1.1))) | ||
void introduced_1_1(); | ||
|
||
void use() { | ||
if (__builtin_available(visionOS 1.2, *)) | ||
introduced_1_1(); | ||
// CHECK: call i32 @__isPlatformVersionAtLeast(i32 11, i32 1, i32 2, i32 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// RUN: %clang_cc1 -triple arm64-apple-xros1 -fapplication-extension -verify=visionos %s 2>&1 | ||
|
||
__attribute__((availability(xros, unavailable))) // visionos-warning {{unknown platform 'xros' in availability macro}} | ||
void xros_unavail(); // visionos-note {{}} | ||
|
||
__attribute__((availability(xros_app_extension, unavailable))) // visionos-warning {{unknown platform 'xros_app_extension' in availability macro}} | ||
void xros_ext_unavail(); // visionos-note {{}} | ||
|
||
__attribute__((availability(visionOSApplicationExtension, unavailable))) | ||
void visionos_ext_unavail(); // visionos-note {{}} | ||
|
||
void use() { | ||
xros_unavail(); // visionos-error {{'xros_unavail' is unavailable: not available on visionOS}} | ||
xros_ext_unavail(); // visionos-error {{'xros_ext_unavail' is unavailable: not available on visionOS}} | ||
visionos_ext_unavail(); // visionos-error {{'visionos_ext_unavail' is unavailable: not available on visionOS}} | ||
} | ||
|
||
__attribute__((availability(visionOS, introduced=1.0))) | ||
void visionos_introduced_1(); | ||
|
||
__attribute__((availability(visionos, introduced=1.1))) | ||
void visionos_introduced_1_1(); // visionos-note 4 {{'visionos_introduced_1_1' has been marked as being introduced in visionOS 1.1 here, but the deployment target is visionOS 1}} | ||
|
||
void use2() { | ||
if (__builtin_available(iOS 16.1, *)) | ||
visionos_introduced_1_1(); // visionos-warning {{'visionos_introduced_1_1' is only available on visionOS 1.1 or newer}} visionos-note {{enclose}} | ||
|
||
if (__builtin_available(xrOS 1.1, *)) // visionos-error {{unrecognized platform name xrOS}} | ||
visionos_introduced_1_1(); // visionos-warning {{'visionos_introduced_1_1' is only available on visionOS 1.1 or newer}} visionos-note {{enclose}} | ||
|
||
if (__builtin_available(xros_app_extension 1, *)) // visionos-error {{unrecognized platform name xros_app_extension}} | ||
visionos_introduced_1_1(); // visionos-warning {{'visionos_introduced_1_1' is only available on visionOS 1.1 or newer}} visionos-note {{enclose}} | ||
|
||
if (__builtin_available(visionOS 1.1, *)) | ||
visionos_introduced_1_1(); | ||
|
||
visionos_introduced_1(); | ||
visionos_introduced_1_1(); // visionos-warning {{'visionos_introduced_1_1' is only available on visionOS 1.1 or newer}} visionos-note {{enclose}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters