<div dir="ltr">Hi Johannes,<div><br></div><div>I think this is a great area of research. For Java, for example, refaster (<a href="http://errorprone.info/docs/refaster">http://errorprone.info/docs/refaster</a>) exists which lets you express simple code changes with "before / after" samples. If we can get something like this based on Clang's AST, that would be most awesome - is this a direction you're working towards?</div><div><br></div><div>Cheers,</div><div>/Manuel</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 22, 2017 at 2:50 AM Johannes Altmanninger via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have been working on creating a syntax tree differencing library.<br>
So far, my focus has been on getting the core algorithm right, some<br>
parts are missing.<br>
<br>
I have submitted a patch [1]. I already received some great feedback and<br>
I am always open to suggestions for improvement.<br>
<br>
Additionally, if you have ideas to discuss about this, please let me<br>
know, then I can keep it in mind while designing.<br>
<br>
I think it should be fairly easy to create a tool that uses the same<br>
output format as diff while only showing semantic changes. More advanced<br>
tools seem to be quite possible also.<br>
<br>
One difficulty I am facing so far is that extracting values of<br>
individual AST nodes requires me to manually combine all relevant<br>
attributes. The value of a node is all things that make it semantically<br>
different from other nodes of the same kind, except for its children.<br>
<br>
After an edit script has been computed it would be possible to apply it,<br>
but in order such an edit script it will be necessary to implement a way<br>
to do the opposite of extracting node information: updating the source<br>
code based on the previously extracted information (node value). It is<br>
probably not particularly difficult but it will require qutie some<br>
effort to do it in a way that it can work for any node.<br>
<br>
<br>
Johannes<br>
<br>
[1] <a href="https://reviews.llvm.org/D34329" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34329</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">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>
</blockquote></div>