[llvm-dev] get function parameters (not arguments)

Mohammad Norouzi via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 10 07:49:53 PST 2017


I tried the original posted code again:

for (auto& A : cast<CallInst>(BI)->arg_operands())
errs() << "--- " << A->getName() << "\n";

but it prints empty (only ---)!

Thank you and best,
Mo



On Fri, Mar 10, 2017 at 4:44 PM, Tim Northover <t.p.northover at gmail.com>
wrote:

> On 10 March 2017 at 15:41, Mohammad Norouzi <mnmomn at gmail.com> wrote:
> > Sorry i'm using the following code:
> >
> > F = (cast<CallInst>(BI))->getCalledFunction();
> > for (auto& A : F->getArgumentList()) {
> >                     errs() << "------- " << A.getName() << " " << "11" <<
> > "\n";
> >            }
> >
> > But how can I get the parameters (as e and f in the example)?
>
> The code you originally posted (using
> cast<CallInst>(BI)->arg_operands()) should iterate through the
> arguments to the call.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170310/3dd4861b/attachment.html>


More information about the llvm-dev mailing list