[cfe-dev] Help with AST (de)serialization API

Sam sam at cs.jhu.edu
Thu Mar 3 12:22:56 PST 2011


I am trying to write some code that can traverse 2 (or more) ASTs from different programs simultaneously. So far my approach has been to use "clang -emit-pch" to create serialized ASTs so that I can then traverse them at-will in my program. I am having trouble, however, successfully loading the ASTs from the PCH files. I tried instantiating an ASTReader and a derivative of ASTConsumer in order to call ASTReader::StartTranslationUnit, but when I do, the program segfaults in Allocator.cpp. Is this even the right approach?*  I've looked into ASTUnit::LoadFromASTFile as well, but was unsure how to move forward once the AST file was loaded. Any guidance is appreciated.

* Admittedly, I am trying to infer a lot from the Clang API documentation.

Thanks for your help,
Sam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110303/c8efcd3d/attachment.html>


More information about the cfe-dev mailing list