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

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

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