[LLVMdev] [LLVMDEV]How could I get function name in this situation?

songlh at cs.wisc.edu songlh at cs.wisc.edu
Wed Jan 26 12:07:54 PST 2011


Hi:

  My llvm code is:

  for( BasicBlock::iterator i = b->begin() , ie = b->end();
       b != be ; b ++ ){
       if( CallInst * pCall = dyn_cast<CallInst>(i)){

          pCall->dump(); //
          Function * pFunction = pCall->getCalledFunction();
          if( !pFunction ){

          }
          std::string fname = pFunction->getName();
       }
  }

  The dump result of the function call I want to find is :

  call void %7(%struct.nsAString* %8, i32 0) nounwind, !dbg !1565

  it returns null from pCall->getCalledFunction(), and I cannot get the
function name.

  How could I get the function name in this situation?

  thanks a lot!

                                        Linhai




More information about the llvm-dev mailing list