[LLVMdev] Accessing a function's arguments

Brian Ensink ensink at cs.uiuc.edu
Fri Oct 11 13:35:01 PDT 2002


I am trying to generate a simple wrapper function: 

    Function* pWrapper = m_module.getOrInsertFunction(name, 
       FunctionType::get(Type::VoidTy, 
	 vector<const Type*>(1, PointerType::get(Type::IntTy)), false));

How do I actually get the Value* for the one argument to this function?
The pWrapper->getArgumentList().size() is 0. Shouldn't the argument list  
contain the Value* for the parameter?

    DEBUG(pWrapper->dump(););
    DEBUG(pWrapper->getFunctionType()->dump());
    DEBUG(cerr << "number of arguments: " << pWrapper->getArgumentList().size() << endl;);

The debug code above prints as below:

    declare void %foo(int*)
    void (int *)
    number of arguments: 0

-- 
Brian Ensink                     www-sal.cs.uiuc.edu/~ensink
Graduate Student, University of Illinois at Urbana-Champaign



More information about the llvm-dev mailing list