<div dir="ltr">Generally roundtripping through ASTs is not something that's encouraged/reliable for reasons such as this. Most tools doing source transformations do so by editing the original code, rather than producing a new derived piece of code.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 6, 2016 at 7:31 AM, Andre Vehreschild via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am working on a project to rework a given program having a large code<br>
base. While using Clang's fine and elaborate ways to understand and<br>
massage an AST, I am missing a way to parse and transfer comments. I<br>
have seen some efforts so far to get doxygen comments for methods and<br>
so on. But what about the comments that document the working of<br>
functions, i.e., all the comment that are in the .cpp files?<br>
<br>
Is there any support on this?<br>
<br>
What would be a good way to get them transfered? A new AST node on<br>
stmt-level to refer to a comment in the SourceManager, i.e., quite light<br>
weight? Or are there other loose ends that I can attach to?<br>
<br>
Because I am constructing the transformed code in a bottom-up way<br>
(bottom being the leaves of the AST), and am just streaming the result<br>
into a stringstream, I can't traverse the resulting code a second time<br>
and inject the comments while looking for source locations.<br>
<br>
Furthermore would it be appreciated to have a way of control on the<br>
transformation process, i.e. tell the clang-tool that for a certain<br>
routine it should do something specific. I.e. a directive should be<br>
available. Any thoughts on this?<br>
<br>
I am willing to develop and provide patches to get that functionality,<br>
but for this I like know a design that would be well perceived and has<br>
chances to make it into clang, i.e., not to waste the effort.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Andre<br>
--<br>
Andre Vehreschild * Email: vehre ad gmx dot de<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div>