So I was looking at LLVM's Call
instruction code, and it has a public constructor like so:
static CallInst *Create(FunctionType *Ty, Value *Func, ArrayRef<Value *> Args,
const Twine &NameStr,
Instruction *InsertBefore = nullptr) {
return new (ComputeNumOperands(Args.size()))
CallInst(Ty, Func, Args, None, NameStr, InsertBefore);
}
Create
calls the appropriate private consstructor CallInst
, but with an integer which I don't understand.
This is the code for ComputeNumOperands
, and you can see that it returns int
.
/// Compute the number of operands to allocate.
static int ComputeNumOperands(int NumArgs, int NumBundleInputs = 0) {
// We need one operand for the called function, plus the input operand
// counts provided.
return 1 + NumArgs + NumBundleInputs;
}
Hence my question: what does new int Constructor()
mean?