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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 13:42:03 PDT 2017


ahatanak added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:2096
+    if (FI.getExtParameterInfo(ArgNo).isNoEscape())
+      Attrs.addAttribute(llvm::Attribute::NoCapture);
+
----------------
rjmccall wrote:
> ahatanak wrote:
> > rjmccall wrote:
> > > You should make sure that building a CGFunctionInfo with an ObjCMethodDecl* collects this from the parameters.  (And add tests!)
> > > 
> > > For blocks, at least, the ObjC method case is arguably more important than the C function case.
> > Should we issue a warning when a parameter of an ObjC method is annotated with noescape and the corresponding parameter of the overriding method in a derived class isn't? Also, should we warn about inconsistent C++ virtual functions too?
> Mmm.  Probably yes in both cases, although we could alternatively just silently propagate the attribute InheritableParamAttr-style.
In the new patch, I chose to print diagnostics when the overriding method is missing noescape on its parameters lest users unintentionally let pointers escape.  


https://reviews.llvm.org/D32210





More information about the cfe-commits mailing list