diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-02-28 07:15:55 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-02-28 07:15:55 +0000 |
commit | 7275da0f2ee24336fe83cb7cfe2ba22f9cefc117 (patch) | |
tree | 9faf6e67f81d54afcaa45b6300b4c150070a2eb3 /clang/docs | |
parent | ac799b05d42fee69a91bf35beb7f87c548827a42 (diff) | |
download | bcm5719-llvm-7275da0f2ee24336fe83cb7cfe2ba22f9cefc117.tar.gz bcm5719-llvm-7275da0f2ee24336fe83cb7cfe2ba22f9cefc117.zip |
[ObjC] Allow declaring __strong pointer fields in structs in Objective-C
ARC mode.
Declaring __strong pointer fields in structs was not allowed in
Objective-C ARC until now because that would make the struct non-trivial
to default-initialize, copy/move, and destroy, which is not something C
was designed to do. This patch lifts that restriction.
Special functions for non-trivial C structs are synthesized that are
needed to default-initialize, copy/move, and destroy the structs and
manage the ownership of the objects the __strong pointer fields point
to. Non-trivial structs passed to functions are destructed in the callee
function.
rdar://problem/33599681
Differential Revision: https://reviews.llvm.org/D41228
llvm-svn: 326307
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/LanguageExtensions.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 6d9bbcbd3a5..bb9b4c11be5 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1191,12 +1191,14 @@ Automatic reference counting Clang provides support for :doc:`automated reference counting <AutomaticReferenceCounting>` in Objective-C, which eliminates the need -for manual ``retain``/``release``/``autorelease`` message sends. There are two +for manual ``retain``/``release``/``autorelease`` message sends. There are three feature macros associated with automatic reference counting: ``__has_feature(objc_arc)`` indicates the availability of automated reference counting in general, while ``__has_feature(objc_arc_weak)`` indicates that automated reference counting also includes support for ``__weak`` pointers to -Objective-C objects. +Objective-C objects. ``__has_feature(objc_arc_fields)`` indicates that C structs +are allowed to have fields that are pointers to Objective-C objects managed by +automatic reference counting. .. _objc-fixed-enum: |