[clang] 5079b27 - [ARC][Documentation] Explicitly state that messaging weak objects keeps a strong reference during call lifetime (#72169)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 13 18:53:19 PST 2023
Author: Akira Hatanaka
Date: 2023-11-13T18:53:15-08:00
New Revision: 5079b27c55137d58ca5f8048248c852d088be55c
URL: https://github.com/llvm/llvm-project/commit/5079b27c55137d58ca5f8048248c852d088be55c
DIFF: https://github.com/llvm/llvm-project/commit/5079b27c55137d58ca5f8048248c852d088be55c.diff
LOG: [ARC][Documentation] Explicitly state that messaging weak objects keeps a strong reference during call lifetime (#72169)
rdar://113636046
Added:
Modified:
clang/docs/AutomaticReferenceCounting.rst
Removed:
################################################################################
diff --git a/clang/docs/AutomaticReferenceCounting.rst b/clang/docs/AutomaticReferenceCounting.rst
index 820ad3978d5f206..bcac73215c9d32e 100644
--- a/clang/docs/AutomaticReferenceCounting.rst
+++ b/clang/docs/AutomaticReferenceCounting.rst
@@ -839,8 +839,21 @@ and non-ownership qualification.
object lvalue.
* For ``__weak`` objects, the current pointee is retained and then released at
- the end of the current full-expression. This must execute atomically with
- respect to assignments and to the final release of the pointee.
+ the end of the current full-expression. In particular, messaging a ``__weak``
+ object keeps the object retained until the end of the full expression.
+
+ .. code-block:: objc
+
+ __weak MyObject *weakObj;
+
+ void foo() {
+ // weakObj is retained before the message send and released at the end of
+ // the full expression.
+ [weakObj m];
+ }
+
+ This must execute atomically with respect to assignments and to the final
+ release of the pointee.
* For all other objects, the lvalue is loaded with primitive semantics.
:arc-term:`Assignment` occurs when evaluating an assignment operator. The
More information about the cfe-commits
mailing list