<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div id="yiv1935230514"><div><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt;"><div id="yiv1935230514yui_3_2_0_22_1330298016815686">Given:<br><span></span></div><div id="yiv1935230514yui_3_2_0_22_13302980168151107"><br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151111">#include <stdbool.h><br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151108"><br>#define M(p) p<br><br>int f ( void )<br>{<br>   true;</div><div id="yiv1935230514yui_3_2_0_22_13302980168151142">   M( true );<br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151145">}<br><br>then, as expected, I get IntegerLiteral Expr nodes of ( 'int' '1' ) for both lines in the function.</div><div
 id="yiv1935230514yui_3_2_0_22_13302980168151160"><br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151161">I can get the macro name corresponding to the first '1' (i.e. 'true') by using:<br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151164"><br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151165">   SL = SM.getSpellingLoc( SM.getImmediateExpansionRange( SL ).first );<br><br>   std::pair< FileID, unsigned > ExpansionInfo = SM.getDecomposedLoc( SL );<br><br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151166">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'.<br></div><div id="yiv1935230514yui_3_2_0_22_13302980168151203"><br>Phil.<br></div></div></div></div></div></body></html>