From: Aaron Ballman Date: Wed, 19 Feb 2014 15:38:02 +0000 (+0000) Subject: Moving the documentation for the objc_method_family attribute into AttrDocs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62c405999857e4bc8b1b1b35955be05b5ece73c9;p=clang 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 --- diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index 516263756a..a6008b2adc 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -1241,31 +1241,6 @@ implementation of an override in a subclass does not call super. For example: - (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 ` -described below. - -Query for this feature with ``__has_attribute(objc_method_family)``. - .. _langext-objc-retain-release: Objective-C retaining behavior attributes diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 8d9e24cfc9..9b8160db49 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -920,7 +920,7 @@ def ObjCMethodFamily : InheritableAttr { ["none", "alloc", "copy", "init", "mutableCopy", "new"], ["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init", "OMF_mutableCopy", "OMF_new"]>]; - let Documentation = [Undocumented]; + let Documentation = [ObjCMethodFamilyDocs]; } def ObjCNSObject : InheritableAttr { diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index 24e393d9c4..ca1a37d5a3 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -239,4 +239,31 @@ caveats to this use of name mangling: 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