r180127 - [libclang] Introduce a CXCursor_ObjCSelfExpr cursor, which is the equivalent of CXCursor_CXXThisExpr for C++ code.

Jordan Rose jordan_rose at apple.com
Tue Apr 23 12:37:10 PDT 2013


On Apr 23, 2013, at 12:16 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

> On Apr 23, 2013, at 12:03 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
>> Sorry, why is this right way to implement this? 'self' is very deliberately not a special kind of expression in Objective-C. Why not expose this on the associated ParmVarDecl instead?
> 
> What is the advantage with that approach ? Whether there is a ParmVarDecl or not seems like an implementation detail of the AST. If you are worried that there is one more cursor to consider, I'd argue the same applies for CXCursor_CXXThisExpr.

CXXThisExpr matches the AST, which matches the C++ standard. There is no Objective-C standard, but certainly 'self' is not treated specially in most cases.

I can't put my finger on it, but it makes a lot more sense to me to say "is this variable 'self'?" than "is this expression 'self'?", especially in init methods where 'self' can be reassigned. 'this' can never be reassigned.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130423/d4c4d93f/attachment.html>


More information about the cfe-commits mailing list