[cfe-dev] Location/storage of AST
Chandler Carruth
chandlerc at google.com
Thu Dec 8 02:33:20 PST 2011
On Thu, Dec 8, 2011 at 1:56 AM, eyasu getahun <eya.get at gmail.com> wrote:
> Hello,
>
> We can get AST after a number of clang's semantical and syntactical
> analysis on the source file. I would like to know where is the place that
> stores the resulting AST's. Is there any database that can store the
> intermediate results while parsing source files? Or is AST built on the fly
> automatically without being stored anywhere?
This last is the most accurate description. The AST is not (generally)
persisted, it is built as we parse the file.
> To clarify more, I can dump AST for the given source code by using clang
> command. where is the source of this dumped file? I guess, when running the
> dump command, it automatically parse the source and and build AST on the
> fly and show the result.
Correct.
> How someone able to capture AST if he/she needs to transform it.
Typically it is transformed in memory after parsing has constructed it. If
you need to serialize the AST to disk, there are serialization routines for
the AST as well as deserialization routines to read it back off of the
disk. All of the AST transformations happen on a complete AST held in
memory. How you get it there and what you do afterward are orthogonal
questions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111208/91d77580/attachment.html>
More information about the cfe-dev
mailing list