Skip to content

Commit 00a4f09

Browse files
authoredApr 11, 2024
[clang][docs] Modernize attribute docs for darwin specifics (#88448)
* Generally recommend target triples. But replace `m*version-min` with `mtargetos`. * Also include test coverage for -mtargetos=visionos
1 parent 4036a69 commit 00a4f09

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed
 

‎clang/include/clang/Basic/AttrDocs.td

+25-12
Original file line numberDiff line numberDiff line change
@@ -1604,27 +1604,40 @@ specifies availability for the current target platform, the availability
16041604
attributes are ignored. Supported platforms are:
16051605

16061606
``ios``
1607-
Apple's iOS operating system. The minimum deployment target is specified by
1608-
the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*``
1609-
command-line arguments.
1607+
Apple's iOS operating system. The minimum deployment target is specified
1608+
as part of the ``-target *arch*-apple-ios*version*`` command line argument.
1609+
Alternatively, it can be specified by the ``-mtargetos=ios*version*``
1610+
command-line argument.
16101611

16111612
``macos``
1612-
Apple's macOS operating system. The minimum deployment target is
1613-
specified by the ``-mmacosx-version-min=*version*`` command-line argument.
1614-
``macosx`` is supported for backward-compatibility reasons, but it is
1615-
deprecated.
1613+
Apple's macOS operating system. The minimum deployment target is specified
1614+
as part of the ``-target *arch*-apple-macos*version*`` command line argument.
1615+
Alternatively, it can be specified by the ``-mtargetos=macos*version*``
1616+
command-line argument. ``macosx`` is supported for
1617+
backward-compatibility reasons, but it is deprecated.
16161618

16171619
``tvos``
1618-
Apple's tvOS operating system. The minimum deployment target is specified by
1619-
the ``-mtvos-version-min=*version*`` command-line argument.
1620+
Apple's tvOS operating system. The minimum deployment target is specified
1621+
as part of the ``-target *arch*-apple-tvos*version*`` command line argument.
1622+
Alternatively, it can be specified by the ``-mtargetos=tvos*version*``
1623+
command-line argument.
16201624

16211625
``watchos``
1622-
Apple's watchOS operating system. The minimum deployment target is specified by
1623-
the ``-mwatchos-version-min=*version*`` command-line argument.
1626+
Apple's watchOS operating system. The minimum deployment target is specified
1627+
as part of the ``-target *arch*-apple-watchos*version*`` command line argument.
1628+
Alternatively, it can be specified by the ``-mtargetos=watchos*version*``
1629+
command-line argument.
1630+
1631+
``visionos``
1632+
Apple's visionOS operating system. The minimum deployment target is specified
1633+
as part of the ``-target *arch*-apple-visionos*version*`` command line argument.
1634+
Alternatively, it can be specified by the ``-mtargetos=visionos*version*``
1635+
command-line argument.
16241636

16251637
``driverkit``
16261638
Apple's DriverKit userspace kernel extensions. The minimum deployment target
1627-
is specified as part of the triple.
1639+
is specified as part of the ``-target *arch*-apple-driverkit*version*``
1640+
command line argument.
16281641

16291642
A declaration can typically be used even when deploying back to a platform
16301643
version prior to when the declaration was introduced. When this happens, the

‎clang/test/Driver/mtargetos-darwin.c

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// RUN: %clang -mtargetos=ios14-macabi -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=MACCATALYST %s
55
// RUN: %clang -mtargetos=tvos14 -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=TVOS %s
66
// RUN: %clang -mtargetos=watchos7.1 -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=WATCHOS %s
7+
// RUN: %clang -mtargetos=visionos1 -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=VISIONOS %s
78

89
// RUN: not %clang -target arm64-apple-ios14 -mtargetos=ios14 -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=NOMIX1 %s
910
// RUN: not %clang -mtargetos=ios14 -arch arm64 -miphoneos-version-min=14 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=NOMIX2 %s
@@ -19,6 +20,7 @@
1920
// MACCATALYST: "-cc1" "-triple" "arm64-apple-ios14.0.0-macabi"
2021
// TVOS: "-cc1" "-triple" "arm64-apple-tvos14.0.0"
2122
// WATCHOS: "-cc1" "-triple" "arm64-apple-watchos7.1.0"
23+
// VISIONOS: "-cc1" "-triple" "arm64-apple-xros1.0.0"
2224

2325
// NOMIX1: error: cannot specify '-mtargetos=ios14' along with '-target arm64-apple-ios14'
2426
// NOMIX2: error: cannot specify '-miphoneos-version-min=14' along with '-mtargetos=ios14'

0 commit comments

Comments
 (0)