[cfe-commits] r142075 - in /cfe/trunk: lib/Sema/SemaExpr.cpp lib/Sema/SemaObjCProperty.cpp test/CodeGenObjCXX/property-object-reference.mm

jahanian fjahanian at apple.com
Mon Oct 17 08:49:28 PDT 2011


On Oct 16, 2011, at 12:29 PM, Chad Rosier wrote:

> Hi Fariborz,
> I believe this commit is causing a failure.
> FAIL: SingleSource/UnitTests/ObjC++/property-reference-object.exec (742 of 868)

I will take a look.

- Thanks, Fariborz

> Mind taking a look?
> 
>  Chad
> 
> 
> On Oct 15, 2011, at 10:36 AM, Fariborz Jahanian wrote:
> 
>> Author: fjahanian
>> Date: Sat Oct 15 12:36:49 2011
>> New Revision: 142075
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=142075&view=rev
>> Log:
>> obj-c++: allow the getter/setter to return/take parameters
>> by reference. // rdar://10188258
>> 
>> Modified:
>>    cfe/trunk/lib/Sema/SemaExpr.cpp
>>    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>>    cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm
>> 
>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=142075&r1=142074&r2=142075&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Oct 15 12:36:49 2011
>> @@ -7264,13 +7264,14 @@
>>         return;
>>       }
>>     }
>> -  } else if (getLangOptions().ObjCAutoRefCount) {
>> +  } else {
>>     const ObjCMethodDecl *setter
>>       = PropRef->getExplicitProperty()->getSetterMethodDecl();
>>     if (setter) {
>>       ObjCMethodDecl::param_const_iterator P = setter->param_begin();
>>       LHSTy = (*P)->getType();
>> -      Consumed = (*P)->hasAttr<NSConsumedAttr>();
>> +      if (getLangOptions().ObjCAutoRefCount)
>> +        Consumed = (*P)->hasAttr<NSConsumedAttr>();
>>     }
>>   }
>> 
>> @@ -7285,6 +7286,7 @@
>>         checkRetainCycles(const_cast<Expr*>(PropRef->getBase()), RHS.get());
>>     }
>>   }
>> +  LHSTy = LHSTy.getNonReferenceType();
>> }
>> 
>> 
>> 
>> Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=142075&r1=142074&r2=142075&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Sat Oct 15 12:36:49 2011
>> @@ -948,7 +948,8 @@
>>                                             ObjCMethodDecl *GetterMethod,
>>                                             SourceLocation Loc) {
>>   if (GetterMethod &&
>> -      GetterMethod->getResultType() != property->getType()) {
>> +      GetterMethod->getResultType().getNonReferenceType() 
>> +      != property->getType().getNonReferenceType()) {
>>     AssignConvertType result = Incompatible;
>>     if (property->getType()->isObjCObjectPointerType())
>>       result = CheckAssignmentConstraints(Loc, GetterMethod->getResultType(),
>> @@ -1510,7 +1511,8 @@
>>       Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
>>     if (SetterMethod->param_size() != 1 ||
>>         !Context.hasSameUnqualifiedType(
>> -          (*SetterMethod->param_begin())->getType(), property->getType())) {
>> +          (*SetterMethod->param_begin())->getType().getNonReferenceType(), 
>> +          property->getType().getNonReferenceType())) {
>>       Diag(property->getLocation(),
>>            diag::warn_accessor_property_type_mismatch)
>>         << property->getDeclName()
>> 
>> Modified: cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm?rev=142075&r1=142074&r2=142075&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm (original)
>> +++ cfe/trunk/test/CodeGenObjCXX/property-object-reference.mm Sat Oct 15 12:36:49 2011
>> @@ -2,9 +2,14 @@
>> // rdar://10188258
>> 
>> struct Foo {int i;};
>> +static Foo gFoo;
>> +
>> 
>> @interface ObjCTest  { }
>> @property (nonatomic, readonly) Foo& FooRefProperty;
>> + at property (nonatomic) Foo  FooProperty;
>> +- (Foo &) FooProperty;
>> +- (void)setFooProperty : (Foo &) arg;
>> @end
>> 
>> 
>> @@ -13,11 +18,18 @@
>> 
>> -(void) test {
>>     Foo& f = self.FooRefProperty;
>> +    Foo& f1 = self.FooProperty;
>> }
>> +- (Foo &) FooProperty { return gFoo; }
>> +- (void)setFooProperty : (Foo &) arg {  };
>> @end
>> 
>> // CHECK: [[T0:%.*]] = load {{%.*}} [[S0:%.*]]
>> // CHECK: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_
>> // CHECK:  [[T2:%.*]]  = bitcast {{%.*}} [[T0]] to i8*
>> // CHECK:  @objc_msgSend
>> +// CHECK: [[R0:%.*]] = load {{%.*}} [[U0:%.*]]
>> +// CHECK: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_
>> +// CHECK:  [[R2:%.*]]  = bitcast {{%.*}} [[R0]] to i8*
>> +// CHECK:  @objc_msgSend
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111017/4e609df6/attachment.html>


More information about the cfe-commits mailing list