I want to implement a self-defined #pragma statement such as #pragma my_pragma, and I want the function definition or if condition following this statement be marked.
For example,
#pragma my_pragma
int f1()
{
...
}
#pragma my_pragma
int
f2()
{
...
}
#pragma my_pragma
if(...){
do ...
}
In the example above, I want the two functions and the condition be marked, and transmit the mark until gimple by gcc plugin without modifying gcc source. Then register a new PASS through PLUGIN_PASS_MANAGER_SETUP to handle gimples based on whether it is marked or not.
I assume this can be implemented by several register_callback() functions with different event.
The problem is, I'm new to the development of gcc plugin, and not familiar with hundreds of classes and functions in gcc source code. I don't know which variable to manipulate and which function to use in the callback function triggered by different events.
I tried to ask chat-gpt for help, but he keeps giving me code snippet with functions and struct which don't exist in gcc at all.
The gcc version I'm using is 10.3.0, by the way.