[cfe-dev] Concurrent AST traversal with libTooling

Marc Jessome marc.jessome at gmail.com
Wed Jan 15 16:55:27 PST 2014


Hello,

I'm using libTooling to parse and traverse the ASTs of full
compilation databases using a RecursiveASTVisitor. I have attached a
small example of how my tool is structured (a modification of
http://clang.llvm.org/docs/RAVFrontendAction.html to use a compilation
database).

I would like to be able to parse each TU and traverse the AST on its
own thread so that I can process multiple TUs concurrently.

Would this be possible with libTooling and tooling::ClangTool as
currently implemented and used in my example? Give the implementation
of newFrontendActionFactory<> I feel like it likely isn't.

If not, the only way that I can currently see this being possible is
by spawning up multiple threads that would each call
tooling::runToolOnCodeWithArgs(), and handling the compilation
database manually. Would this be safe to do with the way clang and
libTooling is currently implemented?

Thanks,
  Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RAV_Example.cpp
Type: text/x-c++src
Size: 1425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140115/a63116c3/attachment.cpp>


More information about the cfe-dev mailing list