title: How to Find All Callers of a Function in C++?
body: <p>I'm refactoring some code in C++, and I want to deprecate some old methods. My current method for finding all of the methods looks like this:</p>
  
  <ol>
  <li>Comment out the original method in the source file in which I'm working.</li>
  <li>Try to compile the code.</li>
  <li>If a compiler error is found, then make a note comment out the call and try to recompile.</li>
  <li>Once the compile has completed successfully, I've found all of the calls.</li>
  </ol>
  
  <p>This totally sucks. I've also tried grepping source for the name of the function calls, but I sometimes run into problems with functions of the same name with different arguments, so my compilation makes the C++ compiler resolve the names for me. I've found <a href="https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method">this question</a> for C#, but my code base is entirely implemented in C++. </p>
  
  <p>Is there a better way to find all of the callers of a class method or function in C++? I'm using GCC on Unix systems, but cross-platform solutions would be superlative. </p>