This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Interface for manipulating the abstract syntax tree
Hi again,
Yes. You can start by calling it in the same place cgraph_create_edges ()
is been called. (cgraph_analyze_function ())
To be able to do that, probably I will need to register a new token
(i.e. MY_PRAGMA_TOKEN) and build a node of this token within the
pragma handler (in c-pragma.c). And later call the the function that
implements the logic of the MY_PRAGMA_TOKEN in
cgraph_analyze_function(). I think that the OMP pragmas are
implemented in a similar way.. (or probably I am wrong).
For now, I could not see a direct way how to get a reference to the
syntax tree from within the c-pragma.c file where I define the pragma
handler and register it as a call back. If by the way someone knows a
method.. I would be very thankful to share it with me..
Check if current_function_decl is actually set when you access it.
Yes current_function_decl is set to the declaration tree of the
current function where the pragma directive is.
void foo()
{
#pragma test_praga
}
the current_function_decl is set to the declaration of foo() (I debugged it)
You can learn more by looking at the function that calls
cgraph_create_edges()
which sets current_function_decl.
I will examine that more carefully.
Revital, thank you very much once again.
Ferad Zyulkyarov