Not clear why would you need this, but here is my note on it: the problem cannot have a strict solution, because it is not well defined.
First issue is that a C++ file is not a functional unit (not a class, not an executable or something like that), but just some text. From an isolated file, it's not always possible to recognize if some variable or a function parameter is a pointer or not. The more general problem is that the pointer is essentially a run-time notion. Strictly speaking, a pointer cannot be defined as an artifact of the text of some program code. Two different variables can present the pointer to the same object; would you list them separately or not? Inversely, during run time a set of pointer does not have to correspond to some names or any artifacts of the code, so how to list them? This is something strictly impossible to tell what it is during compile time. Take a regular linked list. It is all linked with the pointers, these pointers are distinctly different but appears only during run time.
And don't even mention the possibility of prediction of run time based on the text of the code — this is strictly impossible in general case. If you don't understand it or want to learn about it, please start from reading about the important
halting problem, and the fundamental theorem about it, the fundamental theorem of
computability theory:
http://en.wikipedia.org/wiki/Halting_problem[
^],
http://en.wikipedia.org/wiki/Computability_theory_%28computer_science%29[
^].
Are you getting the idea? As this is the ill-posed problem, it should not be solved. And I don't think you can "invent" any strict formulation of the problem or any formulation which would make sense.
—SA