[cfe-commits] r90867 - in /cfe/trunk: lib/Sema/SemaCXXCast.cpp test/SemaObjCXX/cstyle-cast.mm

Sebastian Redl sebastian.redl at getdesigned.at
Wed Dec 9 00:29:53 PST 2009


On Tue, 08 Dec 2009 19:22:37 -0000, Fariborz Jahanian
<fjahanian at apple.com>
wrote:
> Author: fjahanian
> Date: Tue Dec  8 13:22:33 2009
> New Revision: 90867
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=90867&view=rev
> Log:
> Patch to allow cstyle cast of objective-c pointers in objective-c++
> mode as they are pervasive.
> 
> 
>
==============================================================================
> --- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Tue Dec  8 13:22:33 2009
> @@ -1160,6 +1160,10 @@
>    if (CastTy->isDependentType() || CastExpr->isTypeDependent())
>      return false;
>  
> +  // allow c-style cast of objective-c pointers as they are pervasive.
> +  if (CastTy->isObjCObjectPointerType())
> +    return false;
> +  


Isn't this far too lenient? If I understand the position of this code
correctly, it bascially says, "anything at all can be cast to an ObjC
pointer". Including things that make absolutely no sense, such as
composites, void, bool, float, or C++ object pointers.

Sebastian




More information about the cfe-commits mailing list