[cfe-dev] How to use ASTWriter/ASTreader or ASTUnit to do serialization on AST?
Barry Pan
barry1451 at gmail.com
Mon Mar 24 02:12:34 PDT 2014
Hello guys.
Here’s my problem:
I tried to manipulate on multiple ASTs to make a call graph on multiple src files,so far I only got this idea :using the serialization/deserialization way.First saving the ASTs,then recovering them from the saved files and do sth on the AST's data structure(e.g. Decls).
I have readed clang’code and some tips from the mailing list,and now I get a way from the ASTUnit::Save to use ASTWriter to write an AST to a file,but still can’t figure out how to use ASTReader.
My question is:
1.How can i create an ASTUnit object to use the existing code to manipulate ASTWrite,Or I have to copy these codes to do so…
2.Then,after I write the AST to a file,how can I use the ASTReader or some other things to recover the AST to get it’s data.Its constructor requires an ASTContext and some other things,So should I create a new Context to pass over?
I found it difficult to do such things. So can anybody tell me how to do so?If there exits a tutorial or example,I will be so-o-o-o-o-o-o grateful !
Or can you guys give me some other ideas to manipulate on multiple ASTs?
Thank you for your reading!
(This is my first time to ask questions on this mailing list,so please forgive me if I ask questions in a stupid way and forgive my poor English...)
--
View this message in context: http://clang-developers.42468.n3.nabble.com/How-to-use-ASTWriter-ASTreader-or-ASTUnit-to-do-serialization-on-AST-tp4038574.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev
mailing list