linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse-llvm handling of variadic function calls
@ 2017-03-13 12:03 Dibyendu Majumdar
  0 siblings, 0 replies; only message in thread
From: Dibyendu Majumdar @ 2017-03-13 12:03 UTC (permalink / raw)
  To: Linux-Sparse

Hi,

With the provision of type information in pseudo values, the following
modification allows variadic functions to be passed arguments
correctly. I have tested this with printf() mainly - probably more
rigorous testing is needed.

In output_op_call():

 FOR_EACH_PTR(insn->arguments, arg) {
  struct symbol *ftype = get_function_basetype(insn->fntype);
  LLVMValueRef value;
  if (arg->type == PSEUDO_VAL) {
   struct symbol *atype;
   atype = get_nth_symbol(ftype->arguments, i);
   /* Value pseudos do not have type information. */
   /* Use the function prototype to get the type. */
   if (atype)
    value = val_to_value(C, fn, arg->value, atype);
   else
    value = val_to_value(C, fn, arg->value, arg->sym);
  }
  else {
   value = pseudo_to_value(C, fn, insn, arg);
  }
  args[i++] = value;
 } END_FOR_EACH_PTR(arg);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-13 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-13 12:03 sparse-llvm handling of variadic function calls Dibyendu Majumdar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).