Félix Cloutier
2010-Jun-26 01:24 UTC
[LLVMdev] IRBuilder<>::CreateCall, CreateCall2, CreateCall3, ...
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? Félix
Chris Lattner
2010-Jun-26 04:00 UTC
[LLVMdev] IRBuilder<>::CreateCall, CreateCall2, CreateCall3, ...
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
Félix Cloutier
2010-Jun-26 16:49 UTC
[LLVMdev] IRBuilder<>::CreateCall, CreateCall2, CreateCall3, ...
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>
Possibly Parallel Threads
- [LLVMdev] IRBuilder<>::CreateCall, CreateCall2, CreateCall3, ...
- [LLVMdev] Processing functions in call graph SCC "order" with function-level analyses
- [LLVMdev] Processing functions in call graph SCC "order" with function-level analyses
- [LLVMdev] Can I use Clang to parse snippets of C++ code?
- [LLVMdev] Why shouldn't function entry blocks have predecessors?