<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 12, 2014 at 4:42 PM, Milian Wolff <span dir="ltr"><<a href="mailto:mail@milianw.de" target="_blank">mail@milianw.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="">On Thursday 12 June 2014 21:51:28 BugShan wrote:<br>
> Hello all,<br>
>       I am working on a project(AutoCompletion for SublimeText Editor)<br>
> by using Clang but not libclang.Iwant to have a full access to AST.So<br>
> these days, I download and read the clang's source Code(i am new to<br>
> develop the clang tools), and find that every time to call<br>
> CodeCompete(at ASTUnit.cpp), clang will parse the source file again(at<br>
> ParseAST func). I dont know why but I think it won't be slow?In my mind,<br>
> it would restore all the information into the Abstract Syntax Tree after<br>
> parsing the specified source file,and get the result ASTNode by<br>
> condition from calling CodeComplete function. I think if there is some<br>
> reasons, i am wrong, or I skip the important part in clang source code.<br>
>      If anybody understand what i mean and know something, please give<br>
> me some ideas.<br>
<br>
</div>I suggest you to use the clang-c API for this. </blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
We in KDevelop do this, and so<br>
does QtCreator and possibly also XCode.<br></blockquote><div><br></div><div>So does YCMD (<a href="https://github.com/Valloric/ycmd">https://github.com/Valloric/ycmd</a>).</div><div><br></div><div>Off-topic out of curiosity: Milian, does KDevelop has an "extra process" approach?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
When you use that API, you can make clang cache most of the stuff in a<br>
precompiled preamble automatically, which speeds up code completion and<br>
similar reparsing events tremendously.<br>
<br>
For inspiration see e.g.<br>
<a href="https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/duchain/parsesession.cpp" target="_blank">https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/duchain/parsesession.cpp</a><br>

 and <a href="https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/codecompletion/context.cpp" target="_blank">https://projects.kde.org/projects/playground/devtools/plugins/kdev-clang/repository/revisions/master/entry/codecompletion/context.cpp</a><br>

<br>
Bye<br>
<span class=""><font color="#888888">--<br>
Milian Wolff<br>
<a href="mailto:mail@milianw.de">mail@milianw.de</a><br>
<a href="http://milianw.de" target="_blank">http://milianw.de</a><br>
</font></span><div class=""><div class="h5">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div>