Did clang storage the Abstract Syntax Tree after parsing the source file?

Hello all,
      I am working on a project(AutoCompletion for SublimeText Editor) by using Clang but not libclang.Iwant to have a full access to AST.So these days, I download and read the clang's source Code(i am new to develop the clang tools), and find that every time to call CodeCompete(at ASTUnit.cpp), clang will parse the source file again(at ParseAST func). I dont know why but I think it won't be slow?In my mind, it would restore all the information into the Abstract Syntax Tree after parsing the specified source file,and get the result ASTNode by condition from calling CodeComplete function. I think if there is some reasons, i am wrong, or I skip the important part in clang source code.
     If anybody understand what i mean and know something, please give me some ideas.
THX!
Reguard!

I suggest you to use the clang-c API for this. We in KDevelop do this, and so
does QtCreator and possibly also XCode.

When you use that API, you can make clang cache most of the stuff in a
precompiled preamble automatically, which speeds up code completion and
similar reparsing events tremendously.

For inspiration see e.g.
https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/duchain/parsesession.cpp
and https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/codecompletion/context.cpp

Bye

> Hello all,
> I am working on a project(AutoCompletion for SublimeText Editor)
> by using Clang but not libclang.Iwant to have a full access to AST.So
> these days, I download and read the clang's source Code(i am new to
> develop the clang tools), and find that every time to call
> CodeCompete(at ASTUnit.cpp), clang will parse the source file again(at
> ParseAST func). I dont know why but I think it won't be slow?In my mind,
> it would restore all the information into the Abstract Syntax Tree after
> parsing the specified source file,and get the result ASTNode by
> condition from calling CodeComplete function. I think if there is some
> reasons, i am wrong, or I skip the important part in clang source code.
> If anybody understand what i mean and know something, please give
> me some ideas.

I suggest you to use the clang-c API for this.

+1

We in KDevelop do this, and so
does QtCreator and possibly also XCode.

So does YCMD (https://github.com/Valloric/ycmd).

Off-topic out of curiosity: Milian, does KDevelop has an "extra process"
approach?