[cfe-dev] Adding a new pragma to mark a callsite

Raj Barik rkbarik at gmail.com
Fri Nov 8 10:58:50 PST 2013


Hi,

I am trying to add a new #pragma for certain call-sites of a C/C++ program.
For example,

#pragma markme
a = foo(1, 2);

I have been able extend clang to add a pragma handler that has a callback
on the Sema actions. That's the easy part. In Sema action implementation, I
want to ensure that this indeed is a call statement. So,

1) Is there is any boilerplate code (or guidelines) to ensure that the
"pragma" following statement is indeed a call statement.

2)  What would be a convenient way to carry extra information from this
Sema action implementation to the CodeGen for this call statement (in
CGStmt.cpp). I would like to carry more information than just a flag. It
seems a waste to add an extra pointer to Stmt class for this.

3) I understand that CGStmt.cpp is the top level code generator for
statements. Any clue on what path (or function) is taken for a call-site
statement? I need this to emit extra code related to the my pragma.

(Note, this is my first time hacking on clang! Thanks!)

Best Regards,
Raj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131108/bb57cdb7/attachment.html>


More information about the cfe-dev mailing list