[cfe-dev] Did clang storage the Abstract Syntax Tree after parsing the source file?
Manuel Klimek
klimek at google.com
Sun Jun 15 04:37:53 PDT 2014
On Thu, Jun 12, 2014 at 4:42 PM, Milian Wolff <mail at milianw.de> wrote:
> On Thursday 12 June 2014 21:51:28 BugShan wrote:
> > 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?
>
> 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
> --
> Milian Wolff
> mail at milianw.de
> http://milianw.de
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140615/1c24d44e/attachment.html>
More information about the cfe-dev
mailing list