Add new compilation directives to clang?

Hi,all

I just develop some programs which need a new compilation directives,it
just like OpenMP's directives(#pragma omp parallel for),

for example,I want Clang to recognize "#pragma GCB i" and then change i
to idx_i when it generate LLVM IR.

what should I do to archieve this?

Thanks for all

Zhunan

Roughly, you add parsing code to lib/Parse/ParsePragma.cpp, add an
action to include/clang/Parse/Action.h, add some representation in the
AST, add a handler to Sema to create the necessary AST node, and make
CodeGen handle the new AST node.

I'm not sure I quite follow what you're trying to do, though.

-Eli