<br><br><div class="gmail_quote">On Tue Dec 16 2014 at 5:12:25 PM mobi phil <<a href="mailto:mobi@mobiphil.com">mobi@mobiphil.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>Multiple questions:</div><div>1. You should already be able to use ASTUnit to save and load ASTs - why do you need integration with ClangTool?</div><div>2. What are you trying to do? Why do you want to store the AST?</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I need some little detail to be clarified. Did not check, but I assume that "clang -emit-ast" is using ASTUnit::Save. Now the main questions:</div><div>-> is this AST fit to reload it and generate code or do any other actions that one would do with source code? Well, tried to do for instance </div><div>-> is it possible to load the AST by clang itself to generate code?</div><div><br></div><div>I tried this:</div><div>clang  -c Sema.cpp  <bunch of includes, defines>  </div><div>#above one compiles and generates Sema.o from clang Sema.cpp without errors</div><div>clang  -emit-ast Sema.cpp  <bunch of includes, defines> <br></div><div>#this generates Sema.ast without any errors/warnings</div><div>clang -c  Sema.ast</div><div><br></div><div>the latest one whatsoever parameters I try to feed there are compilation errors. For instance <br></div><div><br></div><div><div>.../include/llvm/Support/SourceMgr.h:48:10: error: call to deleted constructor of 'std::unique_ptr<MemoryBuffer>'</div><div>  struct SrcBuffer {</div></div><div><br></div><div>tried to do lunch an older version of clang with the same ast and get an error:</div><div><div><br></div><div>error: PCH file uses an older PCH format that is no longer supported</div><div>error: unable to load PCH file</div></div><div><br></div><div>This makes me thinking that whatsoever similarities or differences there are, clang tries to load my ast as PCH and not as AST.</div><div><br></div><div>This is the context that generated my original question. Now I see that does not make sense to extend the ClangTool.   </div><div><br></div><div>All this makes me thinking that would be nice to have a way to tell to clang infra to l load an AST instead of file to generate code, do static analyzis or any other operation.</div><div><br></div><div>Or... there is a way to do it?</div></div></div></div></blockquote><div><br></div><div>So, why do you want to do that? What's your use case? :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>thanks a lot for<br></div><div><br></div><div>regards</div><div>Mobiphil</div></div>
</div></div>
</blockquote></div>