How do I implement Diagnostic Callbacks?

Hi everyone,
I want my callback to be executed whenever clang tries to report an undeclared identifier.
This callback can potentially trigger another note or fixit diagnostic.

If I have access to a clang::CompilerInstance Object, how do I set this kind of system up?

I would also like to know possible alternatives for achieving this.

Manasij Mukherjee