I'm trying to put together a tool based on libtooling that renames a
class' member variable from the commandline.
I got it to the level that it's useful in practice, but there is one
case I can't handle: when the member variable is used in a macro that
calls another macro.
Here's how to use the tool:
- Build it with 'make', then
- bin/tool -dump -old-name=C::nX -new-name=m_nX test.cxx --
If you replace the call to OUTER() to INNER() in test.cxx, then the
rename is performed correctly. I guess it's something around how I call
the source manager's getImmediateSpellingLoc(), but I'm not sure what's
the exact problem.
Any ideas what I'm missing?
I tested the code only with clang-3.5 that comes by default in openSUSE
13.2, if SVN trunk is different in this regard, please let me know. I'm
attaching the Makefile, the tool itself and the test input.
tool.cxx (7.02 KB)
Makefile (518 Bytes)
test.cxx (287 Bytes)