Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APINotes] Update the documentation with new features #95162

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

egorzhdan
Copy link
Contributor

This adds the documentation for a few recently added Clang API Notes features: C++ namespaces, SwiftImportAs and SwiftCopyable.

This adds the documentation for a few recently added Clang API Notes features: C++ namespaces, `SwiftImportAs` and `SwiftCopyable`.
@egorzhdan egorzhdan requested a review from compnerd June 11, 2024 19:07
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2024

@llvm/pr-subscribers-clang

Author: Egor Zhdan (egorzhdan)

Changes

This adds the documentation for a few recently added Clang API Notes features: C++ namespaces, SwiftImportAs and SwiftCopyable.


Full diff: https://github.com/llvm/llvm-project/pull/95162.diff

1 Files Affected:

  • (modified) clang/docs/APINotes.rst (+34-3)
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

clang/docs/APINotes.rst Outdated Show resolved Hide resolved
clang/docs/APINotes.rst Outdated Show resolved Hide resolved
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
@egorzhdan
Copy link
Contributor Author

The test failures are unrelated to this change.

@egorzhdan egorzhdan merged commit 058486c into llvm:main Jun 12, 2024
4 of 9 checks passed
@egorzhdan egorzhdan deleted the apinotes-doc branch June 12, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants