ClangTool on multiple files with same Consumer

Hi everyone.

Is there some nice way to run a Tool on multiple TranslationUnits without the need to recreate the ASTConsumer every time? (unlike ClangTool::run()).

Thanks for any suggestions or hints.


ClangTool takes a FrontendActionFactory so you can simply create your own. You're probably using newFrontendActionFactory() which expects newASTConsumer() to exist to call. However, if you create your own factory you can do whatever you like.