[PATCH] D55865: [ObjC] Add a new attribute to opt-out of implicit callee retain/release in ARC

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 16:34:25 PST 2018


erik.pilkington created this revision.
erik.pilkington added reviewers: rjmccall, ahatanak, jordan_rose, aaron.ballman.
Herald added subscribers: dexonsmith, jkorous.

This attribute, called "objc_externally_retained", exposes clang's notion of pseudo-`__strong` variables in ARC. Pseudo-strong variables "borrow" their initializer, meaning that they don't retain/release it, instead assuming that someone else is keeping their value alive. If a parameter is annotated with this attribute, it isn't implicitly retained/released in the function body, and is implicitly `const`. This is useful to expose for performance reasons, most functions don't need the extra safety of the retain/release, so programmers can opt-out as needed.

Thanks for taking a look!

rdar://20529015


Repository:
  rC Clang

https://reviews.llvm.org/D55865

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/CodeGenObjC/externally-retained.m
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaObjC/externally-retained.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55865.178811.patch
Type: text/x-patch
Size: 23864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181219/a2f59d58/attachment-0001.bin>


More information about the cfe-commits mailing list