[cfe-dev] [RFC] [GSoC] AST differencing
Johannes Altmanninger via cfe-dev
cfe-dev at lists.llvm.org
Wed Jun 21 17:50:23 PDT 2017
Hi,
I have been working on creating a syntax tree differencing library.
So far, my focus has been on getting the core algorithm right, some
parts are missing.
I have submitted a patch [1]. I already received some great feedback and
I am always open to suggestions for improvement.
Additionally, if you have ideas to discuss about this, please let me
know, then I can keep it in mind while designing.
I think it should be fairly easy to create a tool that uses the same
output format as diff while only showing semantic changes. More advanced
tools seem to be quite possible also.
One difficulty I am facing so far is that extracting values of
individual AST nodes requires me to manually combine all relevant
attributes. The value of a node is all things that make it semantically
different from other nodes of the same kind, except for its children.
After an edit script has been computed it would be possible to apply it,
but in order such an edit script it will be necessary to implement a way
to do the opposite of extracting node information: updating the source
code based on the previously extracted information (node value). It is
probably not particularly difficult but it will require qutie some
effort to do it in a way that it can work for any node.
Johannes
[1] https://reviews.llvm.org/D34329
More information about the cfe-dev
mailing list