[clang] [APINotes] Update the documentation with new features (PR #95162)
Egor Zhdan via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 14:08:33 PDT 2024
https://github.com/egorzhdan updated https://github.com/llvm/llvm-project/pull/95162
>From c9d9d115118471f0ca6a311e44b366ef9fe4fb2b Mon Sep 17 00:00:00 2001
From: Egor Zhdan <e_zhdan at apple.com>
Date: Tue, 11 Jun 2024 19:58:53 +0100
Subject: [PATCH 1/2] [APINotes] Update the documentation with new features
This adds the documentation for a few recently added Clang API Notes features: C++ namespaces, `SwiftImportAs` and `SwiftCopyable`.
---
clang/docs/APINotes.rst | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/clang/docs/APINotes.rst b/clang/docs/APINotes.rst
index a6e200e8bffde..2a688e3dca24d 100644
--- a/clang/docs/APINotes.rst
+++ b/clang/docs/APINotes.rst
@@ -80,11 +80,12 @@ entries:
Name: MyFramework
-:Classes, Protocols, Tags, Typedefs, Globals, Enumerators, Functions:
+:Classes, Protocols, Tags, Typedefs, Globals, Enumerators, Functions, Namespaces:
Arrays of top-level declarations. Each entry in the array must have a
- 'Name' key with its Objective-C name. "Tags" refers to structs, enums, and
- unions; "Enumerators" refers to enum cases.
+ 'Name' key with its Objective-C or C++ name. "Tags" refers to structs,
+ C++ classes, enums, and unions; "Classes" refers to Objective-C classes;
+ "Enumerators" refers to enum cases.
::
@@ -157,6 +158,36 @@ declaration kind), all of which are optional:
- Class: NSBundle
SwiftName: Bundle
+:SwiftImportAs:
+
+ For a class, possible values are ``owned`` (equivalent to
+ ``SWIFT_SELF_CONTAINED``), ``reference`` (equivalent to
+ ``SWIFT_SHARED_REFERENCE``, also requires specifying ``SwiftReleaseOp`` and
+ ``SwiftRetainOp``).
+
+ For a method, possible values are ``unsafe`` (equivalent
+ to ``SWIFT_RETURNS_INDEPENDENT_VALUE``), ``computed_property`` (equivalent to
+ ``SWIFT_COMPUTED_PROPERTY``).
+
+ ::
+
+ Tags:
+ - Name: RefCountedStorage
+ SwiftImportAs: reference
+ SwiftReleaseOp: RCRelease
+ SwiftRetainOp: RCRetain
+
+:SwiftCopyable:
+
+ Allows annotating a C++ class as non-copyable in Swift. Equivalent to
+ ``SWIFT_NONCOPYABLE``, or to an explicit conformance ``: ~Copyable``.
+
+ ::
+
+ Tags:
+ - Name: tzdb
+ SwiftCopyable: false
+
:Availability, AvailabilityMsg:
A value of "nonswift" is equivalent to ``NS_SWIFT_UNAVAILABLE``. A value of
>From 201db9ad4ab7e9aaac84b18c6b1e139b202065f9 Mon Sep 17 00:00:00 2001
From: Egor Zhdan <egor.zhdan at gmail.com>
Date: Tue, 11 Jun 2024 22:08:26 +0100
Subject: [PATCH 2/2] Apply suggestions from code review
Co-authored-by: Saleem Abdulrasool <compnerd at compnerd.org>
---
clang/docs/APINotes.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/docs/APINotes.rst b/clang/docs/APINotes.rst
index 2a688e3dca24d..bc09b16bab5d2 100644
--- a/clang/docs/APINotes.rst
+++ b/clang/docs/APINotes.rst
@@ -161,12 +161,12 @@ declaration kind), all of which are optional:
:SwiftImportAs:
For a class, possible values are ``owned`` (equivalent to
- ``SWIFT_SELF_CONTAINED``), ``reference`` (equivalent to
+ ``SWIFT_SELF_CONTAINED``) or ``reference`` (equivalent to
``SWIFT_SHARED_REFERENCE``, also requires specifying ``SwiftReleaseOp`` and
``SwiftRetainOp``).
For a method, possible values are ``unsafe`` (equivalent
- to ``SWIFT_RETURNS_INDEPENDENT_VALUE``), ``computed_property`` (equivalent to
+ to ``SWIFT_RETURNS_INDEPENDENT_VALUE``) or ``computed_property`` (equivalent to
``SWIFT_COMPUTED_PROPERTY``).
::
More information about the cfe-commits
mailing list