[cfe-commits] r100496 - /cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Ted Kremenek kremenek at apple.com
Tue Apr 6 11:30:05 PDT 2010


On Apr 6, 2010, at 8:47 AM, Fariborz Jahanian wrote:

>> Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=100496&r1=100495&r2=100496&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Apr  5 18:45:09 2010
>> @@ -160,7 +160,7 @@
>>                      PIDecl->getSetterName(),
>>                      DeclPtrTy::make(CCPrimary), isOverridingProperty,
>>                      MethodImplKind);
>> -      PIDecl = ProtocolPtrTy.getAs<ObjCPropertyDecl>();
>> +      PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy.getAs<Decl>());
> 
> Is this right? Here we assume that ProtocolPtrTy.getAs<Decl>() is never null (which may be the case).
> 
> - Fariborz
> 
>> 
>>    }
>>    PIDecl->makeitReadWriteAttribute();

It's no worse than what it was before.  Notice the unconditional dereference of PIDecl afterwards.  That was there before, which is why I thought this had to be non-null.  If this could be null, we obviously need to add a null check and possibly bail out of the method.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100406/5d1f099b/attachment.html>


More information about the cfe-commits mailing list