r183471 - blocks: fixes an ast bug when block pointer variable

John McCall rjmccall at apple.com
Thu Jun 6 18:18:16 PDT 2013


On Jun 6, 2013, at 5:48 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Thu Jun  6 19:48:14 2013
> New Revision: 183471
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=183471&view=rev
> Log:
> blocks: fixes an ast bug when block pointer variable
> is evaluated in a condition expression and then
> dereferenced to envoke the block. This is
> pr15663 and I applied a slight variation of the
> patch with a test case. (patch is from
> Arthur O'Dwyer). Also // rdar://14085217
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaExpr.cpp
>    cfe/trunk/test/CodeGen/blocks.c
> 
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=183471&r1=183470&r2=183471&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jun  6 19:48:14 2013
> @@ -5149,7 +5149,10 @@ static QualType checkConditionalPointerC
> 
>   // The pointer types are compatible.
>   QualType ResultTy = CompositeTy.withCVRQualifiers(MergedCVRQual);
> -  ResultTy = S.Context.getPointerType(ResultTy);
> +  if (isa<BlockPointerType>(LHSTy))

I see nothing suggesting that LHSTy has to be a canonical type.

It would be easy to just remember from above whether you're working
with block pointers or normal ones, though.

John.



More information about the cfe-commits mailing list