<html><head></head><body bgcolor="#FFFFFF"><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "> <<a href="mailto:phil_king@rocketmail.com">phil_king@rocketmail.com</a>> wrote:</span><br></div><div><br></div><div></div><blockquote type="cite"><div><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'.</div></div></div></div></div></div></blockquote><br><div>Think I've got it:</div><div><br></div><div>while ( SM.isMacroArgExpansion( SL ) )</div><div>   SL = SM.getImmediateSpellingLoc();</div><div><br></div><div>Phil.</div></body></html>