importing clang ast


I am importing the Clang AST into Cppcheck. I assume this is something
you want. That other tools reuse Clang.

What approach would you recommend?

For information, I started with libclang. That does not provide all
AST information, for instance you run into UnexposedExpr whenever
there are implicit casts. Would anybody be interested to improve
libclang so that could be used?

I am now trying to import "clang -cc1 -ast-dump" output. That is
basically not too difficult to parse and the ast has much more
information. But well it does not feel like the ideal solution.

I have the feeling that the ast-dump could be tweaked somewhat to be
more import-friendly. If the tweaks are minor maybe it would be ok to
reuse the same code for "debug" output and a "app" output. With reuse
I feel that it would be well-maintained.

Best regards,
Daniel Marjamäki