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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 11:27:26 PDT 2017


ahatanak added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:7251
+    if (const auto *rhproto = dyn_cast<FunctionProtoType>(rhptee))
+      rhptee = S.removeNoEscapeFromFunctionProto(lhproto, rhproto);
+
----------------
rjmccall wrote:
> ahatanak wrote:
> > rjmccall wrote:
> > > I think the right place to do this is probably mergeFunctionTypes.
> > When we have the following conditional operator expression, what is the type of the expression?
> > 
> > ```
> > void func0(__attribute__((noescape)) int *a, int *b);
> > void func1(int *a, __attribute__((noescape)) int *b);
> > 
> > c ? func0 : func1;
> > ```
> > 
> > The standard says the type of each parameter in the composite parameter type list is the composite type of the corresponding parameters of both functions, so I guess mergeFunctionType should drop noescape from both parameters?
> Yes, that sounds right.
I defined a new function (mergeExtParameterInfo) that checks the compatibility of two functions and creates the composite type and used it for C's compatibility checking and C++'s conversion rules. Also, I added new test cases in test/Sema/noescape.c.


https://reviews.llvm.org/D32210





More information about the cfe-commits mailing list