[cfe-dev] Location of typedef types

Sergejs Belajevs sergejs.belajevs at gmail.com
Wed Jan 30 06:37:04 PST 2013


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?

Thanks,
Sergejs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130130/e3b190a9/attachment.html>


More information about the cfe-dev mailing list