[LLVMdev] IRBuilder<>::CreateCall, CreateCall2, CreateCall3, ...

Félix Cloutier felixcca at yahoo.ca
Sat Jun 26 09:49:08 PDT 2010


The possible ambiguity between the "regular" calls and the range call is a good reason, though I don't really think suffixing function names with the number of arguments it takes can make anything more obvious. Besides, if it's forgotten, you get something like Invalid conversion from 'unsigned int' to 'llvm::Value*' initializing argument 3 of 'void llvm::CallInst::init(llvm::Value*, llvm::Value*, llvm::Value*)', which isn't very helpful. (I'm running llvm-gcc-4.2, I'm waiting for Xcode 4 to bring clang++ to my computer.)

Félix

Le 2010-06-26 à 00:00:50, Chris Lattner a écrit :

> 
> On Jun 25, 2010, at 6:24 PM, Félix Cloutier wrote:
> 
>> Hey guys,
>> 
>> Whys are there like 5 variants of CreateCall in IRBuilder<> with numbers appended to them? The only difference I can see is the number of arguments. Aren't C++ function overloads be suited for this?
> 
> An overload could work, but this sort of API makes it more obvious which one you're trying to call and avoids overload ambiguity errors for the range case.
> 
> -Chris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100626/35787634/attachment.html>


More information about the llvm-dev mailing list