PPCallbacks problem

Hi! I faced with following problem. I want to get information about macros. I
understood that its possible with class PPCallbacks. I created my class
MacroFinder, which was inherited from PPCallbacks, defined method
MacroFinder::Ifdef and used the class in following code. However method
MacroFinder::Ifdef weren`t calling. As I understood, it happens because an
instance of Preprocessor is created inside
ASTUnit::LoadFromCompilerInvocation(), and my callbacks are set after
parsing was finished. Can you teel me please how to install a callbacks?

    ClangParser::ClangParser(std::vector< const char *> & args_) :
        const char ** opts = &args.front();
        int opts_num = args.size();

        CompilerInstance oCompilerInstance;
            opts_num, // Argc
            opts, // Argv
            0, // Client
            true, // ShouldOwnClient
            false // ShouldCloneClient

        IntrusiveRefCntPtr< DiagnosticsEngine >

        IntrusiveRefCntPtr< CompilerInvocation > compInvoke =
            makeArrayRef(opts, opts + opts_num), // Args
            diags // Diags

        if (!compInvoke) {
            std::cout << "Can't create compiler invocation for given args" ;
            return -1;
        } else {
            tu = ASTUnit::LoadFromCompilerInvocation(
                compInvoke.getPtr(), // CI
                diags, // Diags
                false, // OnlyLocalDecls
                true, // CaptureDiagnostics
                false, // PrecompilePreamble
                TU_Prefix, // TUKind
                false, // CacheCodeCompletionResults
                false, // IncludeBriefCommentsInCodeCompletion
                false // UserFilesAreVolatile

            MacroFinder oMacroFinder;
            tu -> getPreprocessor().addPPCallbacks(&oMacroFinder);

Look into ASTUnit::LoadFromCompilerInvocationAction that accepts a ASTFrontendAction, giving you more control over the parsing process.

Thanks for your advice! I have done that i was planning.