[llvm-commits] Workaround for PR1508

Duncan Sands baldrick at free.fr
Wed Jun 13 22:51:03 PDT 2007


Hi Chris,

> +  // Inform the MachineModuleInfo of the personality for this  
> landing pad.
> +  ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(2));
> +  assert(CE && CE->getOpcode() == Instruction::BitCast &&
> 
> Please just use cast<> instead of dyn_cast, which guarantees no null  
> return.

but then you don't get the helpful assertion message.

> Please split this out into a helper predicate function.  Inside the  
> loop, please use continue to avoid nesting so much:
> 
> if (!F->isDeclaration()) continue;
> ...
> if (IID != .. && IID != ..) continue;

I deliberately made it ugly because it is a horrible hack - that way
you will be motivated to get rid of it by redesigning exception
handling!  I will prettify it.

Ciao,

Duncan.



More information about the llvm-commits mailing list