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.