[cfe-dev] extra check in ReplaceUsesOfNonProtoTypeWithRealFunction() ?

Chris Lattner clattner at apple.com
Thu Jun 4 09:48:19 PDT 2009


On Jun 4, 2009, at 6:23 AM, Jay Foad wrote:

> Hi,
>
> I noticed this code in lib/CodeGen/CodeGenModule.cpp
> ReplaceUsesOfNonProtoTypeWithRealFunction():
>
>  for (llvm::Value::use_iterator UI = OldFn->use_begin(), E = OldFn- 
> >use_end();
>       UI != E; ) {
>    // TODO: Do invokes ever occur in C code?  If so, we should  
> handle them too.
>    llvm::CallInst *CI = dyn_cast<llvm::CallInst>(*UI++);
>    if (!CI) continue;
>
> For safety, I think it should also check:
>
>    if (UI.getOperandNo() != 0) continue;

You're right, I added this in r72869.  I think this is possible to  
trigger, but I didn't try to make a testcase.  Thanks Jay,

-Chris




More information about the cfe-dev mailing list