clang parser pass example

Posted by anon on Stack Overflow See other posts from Stack Overflow or by anon
Published on 2010-04-22T22:00:34Z Indexed on 2010/04/22 22:03 UTC
Read the original article Hit count: 322

Filed under:
|
|

Hi!

Can anyone paste sample code for a clang extra preprocessor pass where it:

takes every variable named "foo", and renames it "bar", thus making the following code legal:

int main() {
  int foo;
  bar = 5;
}

?

Thanks!

[Aside: what I'm trying to do is write my own macro system for clang. Doing the above will let me inject at the right level to do my rewrites.]

Thanks!

© Stack Overflow or respective owner

Related posts about clang

Related posts about PASS