[cfe-dev] parsing without building an AST tree

Manuel Klimek klimek at google.com
Tue Jul 17 02:11:42 PDT 2012


On Tue, Jul 17, 2012 at 10:07 AM, Anders Bakken <agbakken at gmail.com> wrote:
> Hi
>
> We're writing a clang-based tagger and while trying to improve the
> performance of our solution we came upon this paragraph:

Not sure what your requirements for a "tagger" are, would be curious :)

> "Elsa is not built as a stack of reusable libraries like clang is. It
> is very difficult to use part of Elsa without the whole front-end. For
> example, you cannot use Elsa to parse C/ObjC code without building an
> AST. You can do this in Clang and it is much faster than building an
> AST."
>
> from here: http://clang.llvm.org/comparison.html
>
> We've been using the C-api in clang-c/Index.h but if we could get
> better performance by using the C++ APIs directly we'd gladly do so
> (even if it might change or be harder to use).
>
> Is there an example or some documentation on how to do this somewhere possibly?

You can use the clang preprocessor to tokenize if that's all you need.
Currently there's not really good docs around that, and I don't think
I have a really good example. I can get you some more ideas on how to
go about this if you say that preprocessor-only is what you need.

Cheers,
/Manuel



More information about the cfe-dev mailing list