[cfe-dev] libtooling: source location vs nested macros

Manuel Klimek klimek at google.com
Fri May 8 00:58:40 PDT 2015


On Fri, May 8, 2015 at 9:45 AM Miklos Vajna <vmiklos at vmiklos.hu> wrote:

> Hi,
>
> 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
>

I think the immediate spelling location is only one level - have you tried
just using the spelling location instead?


> 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.
>
> Thanks,
>
> Miklos
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150508/13369d4f/attachment.html>


More information about the cfe-dev mailing list