[cfe-dev] Location of typedef types
Manuel Klimek
klimek at google.com
Wed Jan 30 06:42:38 PST 2013
On Wed, Jan 30, 2013 at 3:37 PM, Sergejs Belajevs <
sergejs.belajevs at gmail.com> wrote:
> Hi all,
>
> we are working on source-to-source transformation tool based on clang and
> have a following problem. Example code:
>
> void foo()
> {
> typedef int i32;
> typedef i32 s32;
> typedef i32 (*pfun)();
>
> i32 a = (s32)0x1234u;
> }
>
> We want to rename i32, s32, pfun and all their occurrences in this
> function. We tried using VisitDeclRefExpr from clang::RecursiveASTVisitor,
> but it didn't walk through typedefs. We tried to use VisitTypedefType and
> it correctly visited all occurrences of i32/s32 for this function, but we
> haven't figured out how to get location information from clang::TypedefType
> to make actual renaming possible.
>
> What would be a working (best?) way to do it?
>
Visit the corresponding TypeLoc (in this case VisitTypedefTypeLoc)
Cheers,
/Manuel
>
> Thanks,
> Sergejs
>
>
> _______________________________________________
> 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/20130130/17e5e3fc/attachment.html>
More information about the cfe-dev
mailing list