[clang] 058486c - [APINotes] Update the documentation with new features

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 05:13:01 PDT 2024


Author: Egor Zhdan
Date: 2024-06-12T13:12:57+01:00
New Revision: 058486c9e8820efee748f946fa773b56c4654feb

URL: https://github.com/llvm/llvm-project/commit/058486c9e8820efee748f946fa773b56c4654feb
DIFF: https://github.com/llvm/llvm-project/commit/058486c9e8820efee748f946fa773b56c4654feb.diff

LOG: [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`.

---------

Co-authored-by: Saleem Abdulrasool <compnerd at compnerd.org>

Added: 
    

Modified: 
    clang/docs/APINotes.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/APINotes.rst b/clang/docs/APINotes.rst
index a6e200e8bffde..bc09b16bab5d2 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``) 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``) or ``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


        


More information about the cfe-commits mailing list