[cfe-commits] r116237 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp lib/Sema/SemaExpr.cpp test/SemaObjC/access-property-getter.m test/SemaObjC/setter-dotsyntax.m

Douglas Gregor dgregor at apple.com
Mon Oct 11 14:36:48 PDT 2010


On Oct 11, 2010, at 2:29 PM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Mon Oct 11 16:29:12 2010
> New Revision: 116237
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=116237&view=rev
> Log:
> This patch does a few things in the area of objective-c
> properties.
> 1. Generates the AST for lexical info. of accessing 
>   getter/setter methods using dot-syntax notation.
>   This fixes //rdar: //8528170.
> 2. Modifes rewriter to handle the AST putout in 1.
> 3. Supportes in rewriter ObjCImplicitSetterGetter ASTs.
> 
> Added:
>    cfe/trunk/test/SemaObjC/setter-dotsyntax.m
> Modified:
>    cfe/trunk/lib/Rewrite/RewriteObjC.cpp
>    cfe/trunk/lib/Sema/SemaExpr.cpp
>    cfe/trunk/test/SemaObjC/access-property-getter.m
> 
> 
> @@ -3286,14 +3289,18 @@
>         // Check the use of this method.
>         if (DiagnoseUseOfDecl(OMD, MemberLoc))
>           return ExprError();
> -        // It is important that start and end position is the first character
> -        // and last character position of the property-dot syntax expression.
> -        SourceLocation MemberEndLoc = PP.getLocForEndOfToken(MemberLoc, 1);
> -        return Owned(ObjCMessageExpr::Create(Context,
> -                                             OMD->getSendResultType(),
> -                                             BaseExpr->getExprLoc(), 
> -                                             BaseExpr, Sel,
> -                                             OMD, NULL, 0, MemberEndLoc));
> +        Selector SetterSel =
> +          SelectorTable::constructSetterName(PP.getIdentifierTable(),
> +                                             PP.getSelectorTable(), Member);
> +        ObjCMethodDecl *SMD = 0;
> +        if (Decl *SDecl = FindGetterSetterNameDecl(QIdTy, /*Property id*/0, 
> +                                                   SetterSel, Context))
> +          SMD = dyn_cast<ObjCMethodDecl>(SDecl);
> +        QualType PType = OMD->getSendResultType();
> +        return Owned(new (Context) ObjCImplicitSetterGetterRefExpr(OMD, PType,
> +                                                                   SMD, 
> +                                                                   MemberLoc, 
> +                                                                   BaseExpr));
>       }
>     }


Much nicer, thanks!

	- Doug



More information about the cfe-commits mailing list