<div dir="ltr">On Mon, Jun 24, 2013 at 3:53 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div class="h5">On Mon, Jun 24, 2013 at 3:15 PM, Todd Nowacki <span dir="ltr"><<a href="mailto:nowacki724@gmail.com" target="_blank">nowacki724@gmail.com</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div>I'm currently trying to implement a checker that needs to know when a certain macro is invoked.<div>


<br></div><div><div>For example, if I had something like:</div>
<div>#define MY_MACRO(x)  ...<br></div><div><br></div><div>I would want to check if the statement is MY_MACRO and then inspect its argument. </div><div><br></div><div><div>I see that with checkPreStmt or checkPostStmt. I can check if it is a macro, via getLocStart and isMacroID. Is there a way to get the name of the macro and it's argument (if it has one)?</div>



<div>I see that MacroInfo could be used to get the args possibly, but it doesn't seem to give me the name. </div></div><div></div></div></div></blockquote></div><br></div><div class="gmail_extra"><br></div></div></div>
<div class="gmail_extra">

You can get the name of the macro by looking into the source buffer; get the expansion location and use something like Lexer::getRawToken to pull out the name.</div><span class=""><font color="#888888"><div class="gmail_extra">
</div></font></span></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Err, actually you probably want Lexer::getSpelling(), which returns something a bit easier to work with.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">-Eli</div></div>