[PATCH] D32210: [Sema][ObjC] Add support for attribute "noescape"

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 17:09:02 PDT 2017


ahatanak updated this revision to Diff 106735.
ahatanak marked 3 inline comments as done.
ahatanak added a comment.

Address review comments.

- Allow attaching "noescape" to pointers other than block pointers. Update the docs accordingly.
- Attach attribute "nocapture" to parameters that are annotated with "noescape".
- Call Sema::isValidPointerAttrType to determine whether "noescape" can be applied to a parameter. Also, use the existing warning "warn_attribute_pointers_only" rather than defining a new warning that will be used just for noescape.

I also thought about what else we can do in the front-end when a parameter has 'noescape".  One idea is to do something similar to what r301667 did and omit emitting retains and releases of block captures when the block is passed to a function taking a noescape parameter. If that is viable, I can look into it after committing this patch.


https://reviews.llvm.org/D32210

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/CGCall.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenObjC/noescape.m
  test/SemaObjCXX/noescape.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32210.106735.patch
Type: text/x-patch
Size: 7699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170715/832e8a9a/attachment.bin>


More information about the cfe-commits mailing list