Displaying 1 result from an estimated 1 matches for "printftyp".
Did you mean:
printfty
2018 Apr 04
1
Call printf with new args
...SmallVector<Value *, 8> args;
Value *v = B.CreateGlobalString("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:
voi...