[cfe-commits] r68865 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGen/kr-style-block.c

Chris Lattner clattner at apple.com
Sat Apr 11 11:38:27 PDT 2009


On Apr 11, 2009, at 10:55 AM, Fariborz Jahanian wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=68865&view=rev
> Log:
> Fixes a ir-gen crash for K&R style blocks.

Cool, one minor nit:

> +  const FunctionType *BlockFunctionType = BExpr->getFunctionType();
> +  QualType ResultType;
> +  bool IsVariadic;
> +  if (!isa<FunctionNoProtoType>(BlockFunctionType)) {
> +    const FunctionProtoType *FTy =  
> cast<FunctionProtoType>(BlockFunctionType);

Instead of the if(!) + cast, how about using dyn_cast:

> +  if (const FunctionProtoType *FTy =
            dyn_cast<FunctionProtoType>(BlockFunctionType))) {

-Chris



More information about the cfe-commits mailing list