Keeping AST data for includes

Hello, cfe-dev!

While processing big source code trees with ASTFrontendAction and custom
ASTConsumer, same include files are getting hit and parsed all over and
over again.
Is there any technique (except precompiled header) to prevent such
actions? Like keeping header-related AST data and referencing it within
next files' AST?

Thanks!

That's what precompiled headers do.

If you want each header to have an independent, stored AST, then you're in trouble, since every #include can affect every #include that follows it, and the dependencies between those #includes are very fine-grained.

  - Doug

Hi Douglas!

No, it isn't. You'd still have to manage dependencies:

a.h:
struct Foo { };

b.h:
#include "a.h"

c.h:
#define Foo Bar
#include "a.h"

  - Doug