[PATCH] D32210: [Sema][ObjC] Add support for attribute "noescape"
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 18 19:14:59 PDT 2017
ahatanak created this revision.
This patch adds support for attribute "noescape", which is used to tell the compiler that a block passed to a function will not be called after the function returns.
To ensure that the block does not escape, clang imposes the following restrictions on its usage:
- Cannot be passed to a function expecting an escaping block
- Cannot be returned from a function
- Cannot be captured by a block
- Cannot be assigned to a variable
There are other improvements we can make to Sema and CodeGen if the compiler can tell whether a block escapes or not, which should follow this patch.
rdar://problem/19886775
https://reviews.llvm.org/D32210
Files:
include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaStmt.cpp
test/SemaObjCXX/noescape.mm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32210.95679.patch
Type: text/x-patch
Size: 11408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170419/52fc0046/attachment.bin>
More information about the cfe-commits
mailing list