Hi all,
I am trying to write a check where I need name of the macro used in the source code.
E:g – (Sample source code)
#define SLEEP 20
#define WAKE 10
int g_var = 10;
U1 U1_Function()
{
If(g_var == 20) {
return (SLEEP); // I need to get the macro name in string format as ‘SLEEP’
}
return WAKE; // I need to get the macro name in string format as ‘WAKE’.
}
I am able to check if particular statement contains macro or not using ‘containsMacro’ function.
But I am not getting the actual macro name, though I tried using ‘getMacroNameOrSpelling’.
When I used ‘getMacroNameOrSpelling’, I either get ‘return’ or ‘(‘ in the string but not the actual macro name.
Kindly suggest me a way to get macro name in a Stmt.
Thanks in advance.
Regards,
Prashant S. Purohit