Displaying 1 result from an estimated 1 matches for "const_printf".
2018 Apr 04
1
Call printf with new args
...uot;hi", "str");
args.push_back(v);
SmallVector<Type*, 8> params;
params.push_back(v->getType());
Module *M = B.GetInsertBlock()->getParent()->getParent();
FunctionType *printfType = FunctionType::get(B.getInt32Ty(), params,
true);
Constant* const_printf = M->getOrInsertFunction("printf", printfType);
Function *F = cast<Function>(const_printf);
F->dump();
CallInst * opInst = B.CreateCall(F, args, "call");
It crashes with:
void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*,
llvm::ArrayRef<llv...