Want to write a static code analysis tool to locate all possible dangling pointer in c++ code

Hi All,
I am new to LLVM and trying to learn it. Actually I want to solve dangling pointer problem in a very big and complex C++ project by static code analysis. My idea is to find all possible pointers which may point to a particular type of object within the data structure in the code. Application should be smart enough to understand normal C++ Up-casting or down-casting by dynamic-cast etc.

It seems LLVM’s “Alias Analysis Infrastructure” and CallGraphPass may be useful to do the above kind of job at least to some extent. But unfortunately I am not familiar how to write such a tool. If you think it is possible to implement my idea using LLVM then please let me know how I can write such a tool. Any kind of help or example is welcome.