From: Alex Denisov <1101.debian@gmail.com> Date: Thu, 23 Jul 2015 21:53:13 +0000 (+0000) Subject: Add documentation for the objc_boxable attribute X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21442a13e0f425c450ceb6f67899157659f68c0b;p=clang Add documentation for the objc_boxable attribute git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243048 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 753e42c950..d3b4555573 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -1143,7 +1143,7 @@ def ObjCRuntimeName : Attr { def ObjCBoxable : Attr { let Spellings = [GNU<"objc_boxable">]; let Subjects = SubjectList<[Record], ErrorDiag, "ExpectedStructOrUnion">; - let Documentation = [Undocumented]; + let Documentation = [ObjCBoxableDocs]; } def OptimizeNone : InheritableAttr { diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index deaabc1939..0aeef2c4dd 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -492,6 +492,34 @@ can only be placed before an @protocol or @interface declaration: }]; } +def ObjCBoxableDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Structs and unions marked with the ``objc_boxable`` attribute can be used +with the Objective-C boxed expression syntax, ``@(...)``. + +**Usage**: ``__attribute__((objc_boxable))``. This attribute +can only be placed on a declaration of a trivially-copyable struct or union: + +.. code-block:: objc + + struct __attribute__((objc_boxable)) some_struct { + int i; + }; + union __attribute__((objc_boxable)) some_union { + int i; + float f; + }; + typedef struct __attribute__((objc_boxable)) _some_struct some_struct; + + // ... + + some_struct ss; + NSValue *boxed = @(ss); + + }]; +} + def AvailabilityDocs : Documentation { let Category = DocCatFunction; let Content = [{