[swift-dev] Question about dump-ast and logging the output to file

Marcel Rebouças mscreboucas at gmail.com
Wed Aug 24 12:27:17 CDT 2016


Hello everybody,

I am planning in doing some research and analysis with the ASTs of swift
programs and, for that reason, *I am trying to modify the compiler to
always generate a file with the contents of the -dump-ast flag when
building a project.*

However, I wanted to do this even *without the -dump-ast flag*, since it
can't be used in conjunction with -emit-modules flags. This is also
necessary because I'm using this modified version as a custom toolchain in
Xcode, so all the building process (and flags) are being handed by it.

Apart from the files that handles the flags (e.g.. lib/Immediate/REPL.cpp,
lib/Frontend/CompilerInvocation.cpp), *I am having problems to find
how/where the act of dumping actually starts (where the visitor to
print/dump starts)*. From that point, I could then try to "force" the
dumping, and change the output to a file. I am not familiar with the
project nor C++, so it is being a challenge.

Any thoughts on how I could achieve this? Any directions on how to do it
would be appreciated.

Thanks,
Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160824/317e9dff/attachment.html>


More information about the swift-dev mailing list