Skip to content
Snippets Groups Projects
Commit 62c40599 authored by Aaron Ballman's avatar Aaron Ballman
Browse files

Moving the documentation for the objc_method_family attribute into AttrDocs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201686 91177308-0d34-0410-b5e6-96231b3b80d8
parent 423f00af
No related branches found
No related tags found
No related merge requests found
...@@ -1241,31 +1241,6 @@ implementation of an override in a subclass does not call super. For example: ...@@ -1241,31 +1241,6 @@ implementation of an override in a subclass does not call super. For example:
- (void) AnnotMeth{}; - (void) AnnotMeth{};
^ ^
Objective-C Method Families
---------------------------
Many methods in Objective-C have conventional meanings determined by their
selectors. It is sometimes useful to be able to mark a method as having a
particular conventional meaning despite not having the right selector, or as
not having the conventional meaning that its selector would suggest. For these
use cases, we provide an attribute to specifically describe the "method family"
that a method belongs to.
**Usage**: ``__attribute__((objc_method_family(X)))``, where ``X`` is one of
``none``, ``alloc``, ``copy``, ``init``, ``mutableCopy``, or ``new``. This
attribute can only be placed at the end of a method declaration:
.. code-block:: objc
- (NSString *)initMyStringValue __attribute__((objc_method_family(none)));
Users who do not wish to change the conventional meaning of a method, and who
merely want to document its non-standard retain and release semantics, should
use the :ref:`retaining behavior attributes <langext-objc-retain-release>`
described below.
Query for this feature with ``__has_attribute(objc_method_family)``.
.. _langext-objc-retain-release: .. _langext-objc-retain-release:
Objective-C retaining behavior attributes Objective-C retaining behavior attributes
......
...@@ -920,7 +920,7 @@ def ObjCMethodFamily : InheritableAttr { ...@@ -920,7 +920,7 @@ def ObjCMethodFamily : InheritableAttr {
["none", "alloc", "copy", "init", "mutableCopy", "new"], ["none", "alloc", "copy", "init", "mutableCopy", "new"],
["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init", ["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init",
"OMF_mutableCopy", "OMF_new"]>]; "OMF_mutableCopy", "OMF_new"]>];
let Documentation = [Undocumented]; let Documentation = [ObjCMethodFamilyDocs];
} }
def ObjCNSObject : InheritableAttr { def ObjCNSObject : InheritableAttr {
......
...@@ -239,4 +239,31 @@ caveats to this use of name mangling: ...@@ -239,4 +239,31 @@ caveats to this use of name mangling:
Query for this feature with ``__has_extension(attribute_overloadable)``. Query for this feature with ``__has_extension(attribute_overloadable)``.
}]; }];
}
def ObjCMethodFamilyDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Many methods in Objective-C have conventional meanings determined by their
selectors. It is sometimes useful to be able to mark a method as having a
particular conventional meaning despite not having the right selector, or as
not having the conventional meaning that its selector would suggest. For these
use cases, we provide an attribute to specifically describe the "method family"
that a method belongs to.
**Usage**: ``__attribute__((objc_method_family(X)))``, where ``X`` is one of
``none``, ``alloc``, ``copy``, ``init``, ``mutableCopy``, or ``new``. This
attribute can only be placed at the end of a method declaration:
.. code-block:: objc
- (NSString *)initMyStringValue __attribute__((objc_method_family(none)));
Users who do not wish to change the conventional meaning of a method, and who
merely want to document its non-standard retain and release semantics, should
use the retaining behavior attributes (``ns_returns_retained``,
``ns_returns_not_retained``, etc).
Query for this feature with ``__has_attribute(objc_method_family)``.
}];
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment