[cfe-dev] Getting the name of a macro passed as an argument to another macro
Phil King
phil_king at rocketmail.com
Mon Feb 27 15:33:25 PST 2012
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120227/e12e39c5/attachment.html>
More information about the cfe-dev
mailing list