On Oct 3, 2011, at 10:58 AM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Mon Oct  3 12:58:21 2011
> New Revision: 141009
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=141009&view=rev
> Log:
> objc++: Accessing explicit property of reference type need 
> not bind to a temporary. Fixes //rdar://10188258
> 
> Added:
>    cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm
> Modified:
>    cfe/trunk/lib/Sema/SemaExpr.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=141009&r1=141008&r2=141009&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct  3 12:58:21 2011
> @@ -7388,7 +7388,13 @@
>             << PRE->getBase()->getType();
>     }
>   }
> -  
> +  else {
> +    // lvalue-ness of an explicit property is determined by
> +    // property type.
> +    ObjCPropertyDecl *PDecl = PRE->getExplicitProperty();
> +    VK = Expr::getValueKindForType(PDecl->getType());
> +  }
> +    
>   E = ImplicitCastExpr::Create(Context, T, CK_GetObjCProperty,
>                                E, 0, VK);

This is actually really interesting. It seems to me that we want to determine 
the value kind based on the return type of the getter, in case something does 
something like this:

@interface A
@property std::string Property;
- (const std::string&)Property;
@end

I think this is fairly reasonable.

        - Doug
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to