[LLVMdev] Question about function arguments

Hemanth Murthy hm2474 at columbia.edu
Wed Jul 21 22:16:39 PDT 2010

Hello All,

I was wondering how I could determine the values of function arguments using
the iterators defined in Function.cpp.

Any advice or hints would be great..!

Basically, what I am trying out is:

Function foo has the following function body:
int foo(int a, int b) {


Function * f = module->getFunction("foo");

Function::arg_iterator start = f->arg_begin();
Function::arg_iterator end = f->arg_end();

while(start != end) {
      Argument * value = (Argument *)start;
      cout << "\n Argument: << value->getNameStr();

This piece of code works if 'module' contains the definition of function
foo. Otherwise, I just get blanks even though the number returned by
arg_size() is two.

If foo is just a function being called from 'module', then how  do I
determine the arguments.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/6851e67d/attachment.html>

More information about the llvm-dev mailing list