<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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="gmail_quote"><div>Well, there are currently multiple use cases in clang: pch files (precompiled headers), pcm files (modules), and I think arcmigrate uses ASTUnit (but I don't know the details).</div></div></blockquote><div><br></div><div>though does make sense to tell to the compiler to say generate pch from a C++ file as it does not make sense, it makes sense to generate AST, which is possible, but.. still... it is impossible to load AST, regardless of the size. Any usecase I was thinking about would hold the AST temporary, so would not be an issue. Did some test and in avarage ast files are bit more than double larger as an object file with debug information.</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"><div class="gmail_quote"><div>The problem is that when you store the AST for a full TU, it's *huge* (all the transitive headers are in it) and I'm not sure why you would want to do that.</div></div></blockquote><div>Well, from a TU point of view it makes sense to have the header information. When you analyze or (do code completion, I assume), you need the full bagage. Though having symbols that are not required by the cpp file is overhead. Is there any feature to say: discard unreferenced symbols (types, globals etc.). Still not sure how code completion works and how adding new symbols added to the code are updated (if at all) in the AST.</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"><div class="gmail_quote"><div>If you think tools are too slow, then our proposed solution for that is using C++ modules (which will also dump the AST, but in a much more nuanced and smart fashion).</div></div></blockquote><div> </div><div>well, did some research if it would be possible to build llvm and clang with C++ modules. No luck? Any hints?</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"><div class="gmail_quote"><div>That's why the use case matters; if you're interested in processing speed, the solution is modules (and the way it serializes the AST).<br></div></div></blockquote><div>happy with that... would be happy to see llvm/clang built with modules. I am sure one could find all info in module based AST's that can be found in non-module AST's. </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"><div class="gmail_quote"><div>If your use case is something else, the answer might be something different :)<br></div></div></blockquote></div><br>
</div><div class="gmail_extra">so far I can do my job, I found enough examples in libclang to load from AST, just was wondering what is the point to dump AST with clang without being able to explicitly load it in most of the tools.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>