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:
- Comment out the original method in the source file in which I'm working.
- Try to compile the code.
- If a compiler error is found, then make a note comment out the call and try to recompile.
- Once the compile has completed successfully, I've found all of the calls.
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 this question for C#, but my code base is entirely implemented in C++.
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.