Given:
#include <stdbool.h>
#define M(p) p
int f ( void )
{
true;
M( true );
}
then, as expected, I get IntegerLiteral Expr nodes of ( ‘int’ ‘1’ ) for both lines in the function.
I can get the macro name corresponding to the first ‘1’ (i.e. ‘true’) by using:
SL = SM.getSpellingLoc( SM.getImmediateExpansionRange( SL ).first );
std::pair< FileID, unsigned > ExpansionInfo = SM.getDecomposedLoc( SL );
How do I get the name of the macro passed as the argument to the function-like macro? The code above gives the argument name, ‘p’.
Phil.