pragmas, source-to-source

Hi all,

I’ve just started using clang. I would like to use it for source-to-source transformations. For start, I would like to do the following:
If a #pragma <some_name> precedes a function call, then change the name of the function to be called. For example:

input:

#pragma <…>
my_func(…)

output:

my_function_NEW(…)

I’ve been looking at the objC->C example and I understand (to limited extent tho, how to use Rewriter class to modify the input file). Also, I’ve familiarize myself with HandlePragma mechanism, and I am able to indentify that there is a #pragma <…> in the code.

The thing that I don’t know is how to pass the information from lexical/syntax anlysis to the ASTConsumer, i.e how do I say (in this example) that specific call to my_func() should be renamed? Should I use SourceLocation or there is a better way?

Thanks.

Cedomir.