linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: sparse-llvm handling of variadic function calls
Date: Mon, 13 Mar 2017 12:03:29 +0000	[thread overview]
Message-ID: <CACXZuxdpJdzGCVbjnNcYvBGyRmtYv4JHGP4zbn43717DQELOwg@mail.gmail.com> (raw)

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);

                 reply	other threads:[~2017-03-13 12:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACXZuxdpJdzGCVbjnNcYvBGyRmtYv4JHGP4zbn43717DQELOwg@mail.gmail.com \
    --to=mobile@majumdar.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).