[LLVMdev] API design

Reid Spencer rspencer at reidspencer.com
Mon Jul 2 18:06:45 PDT 2007


On Tue, 2007-07-03 at 09:04 +1200, Keith Bauer wrote:
> > > I'd like to get the extra checks working so that they can help find our
> > > more subtle bugs. Any idea what we should do here?
> >
> > I don't really have a good idea, but I also don't want to significantly
> > uglify the sourcebase...
> 
> #define V_CALLINST(V, Args) new CallInst(V, Args.size() == 0 ? NULL :
> &Args[0], Args.size())

I'd actually prefer a new constructor here. One that doesn't take any
Args at all. API wise its a little more clear what's going on, so you'd
have:

if (Args.size())
  new CallInst(V, &Args[0], Args.size());
else
  new CallInst(V);

Or any other permutation using ternary operator and/or macros.

Reid.

> 
> :p
> 
> -Keith
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list