[cfe-dev] LibTooling vs. LibClang+Python for simple refactoring
legalize at xmission.com
Sun Dec 29 16:41:46 PST 2013
In article <9A22DC3C-F2D5-4081-A593-C6E2F022DD08 at fz-juelich.de>,
"Schlottke, Michael" <m.schlottke at fz-juelich.de> writes:
> Do you have any experience/recommendations for which library is the one to
> use in this case?
I spiked a refactoring tool to replace (void) argument list to
function signatures with an empty argument list ().
I looked at libclang, but it's a C interface and I would prefer to
deal with C++ and not C.
It was very easy to get this going with libtooling. I was inspired by
watching a Chandler Carruth talk about libtooling. My solution ended
up being about 300 lines of code and is pretty straightforward. I
used remove-cstr-calls as my starting point and went from there. Not
only was it not much code, but I was able to make progress quickly by
starting with simple cases and working my way up to more complicated
I've used this example as the basis of a proposed talk for C++ Now!
2014. Hopefully that talk will be accepted; otherwise it will turn
into a blog post and/or video tutorial.
I'm not sure if this list accepts attachments, so I'll provide links
Here is my test input to my remove-void-args tool:
And here is the result after applying the tool:
Since you're interested in doing a Rename refactoring, here is a test
suite I wrote up for evaluating C++ refactoring tools. There are many
test cases in there for Rename of symbols. Why reinvent the wheel?
Please use it and give me any feedback on ways it could be improved:
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
More information about the cfe-dev