title: How can I get Function Name of indirect call from CallInst in LLVM
body: <pre><code>Function *fun = call-&gt;getCalledFunction();
  </code></pre>
  
  <p><code>getCalledFunction();</code> returns null if it's indirect call. How can I get the name of the function or the name of the pointer?</p>
  
  <p>I found all questions in Stack Overflow related to this issue talked about function name of direct call, or type of pointer.</p>
  
  <p>I just want to track cases like this one:</p>
  
  
  
  <pre><code>void foo(){}
  void goo(){}
  void main(){
    int x = 1;
    void (*p)();
    if(x)
      p = &amp;foo;
    else
      p = &amp;goo;
    p(); // print the called function name
  }
  </code></pre>