[cfe-users] traversing the ast using libtooling

2016-08-04 Thread folkert via cfe-users
Hi,

When I want to walk over the complete ast and visit each node (by using
a RecursiveASTVisitor<...>), do I need to implement all of TraverseDecl,
TraverseStmt and TraverseType? Because with all of those it looks like
some code is processed twice.

Second question: there are other Traverse...-methods as well:
TraverseAttr for example. Shouldn't I implement that one as well to get
all data?


Folkert van Heusden

-- 
---
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


[cfe-users] Redirecting clang tooling errors

2016-08-04 Thread Lucas Soltic via cfe-users
Hello,

I am trying to redirect the output emitted when running a tool through 
clang::tooling::runToolOnCode() to a buffer or string instead of stderr 
(llvm::errs()). I'm using clangTooling from release 3.9.

When looking at clangTooling code and following the execution flow, I have 
found the following:
clang::tooling::runToolOnCode()
calls clang::tooling::runToolOnCodeWithArgs()
which calls clang::tooling::ToolInvocation::run()
which contains the following :
TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts);
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr(new DiagnosticIDs()), &*DiagOpts,
DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);

So at this point I guess I'm stuck because everything is redirected to stderr…
Did I miss something or is there really this limitation?

I also thought of redirecting stderr to somewhere else but… I can't see how it 
will fit my needs as in the end I want to call clang::tooling::runToolOnCode() 
on different files in parallel, all of it in the same process ; so I'll get 
stderr mixed with output from several executions. The best solution would 
obviously being able to provide the DiagnosticConsumer but at the moment 
everything looks hardcoded.


Best regards,
L. Soltic

___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users