<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I am trying to add a new #pragma for certain call-sites of a C/C++ program. For example,</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">#pragma markme</div><div style="font-family:arial,sans-serif;font-size:13px">a = foo(1, 2);</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I have been able extend clang to add a pragma handler that has a callback on the Sema actions. That's the easy part. </div>
<div style="font-family:arial,sans-serif;font-size:13px">In Sema action implementation, I want to ensure that this indeed is a call statement. So, </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
1) Is there is any boilerplate code (or guidelines) to ensure that the "pragma" following statement is indeed a call statement. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
2) What would be an efficient way to carry extra information from this Sema action implementation to the CodeGen for this call statement/expression (ie, 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.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">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 expression? I need this to emit extra code related to the my pragma.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">(Note, this is my first time hacking on clang! Thanks!)</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks,</div><div style="font-family:arial,sans-serif;font-size:13px">Raj</div></div>