<div dir="ltr">That is not proper way for me. <div>I cannot include the header and compile source and I don't know macro names that i want to evaluate.</div><div>There is no any reason to use C++ API, but if you know how to do it with libclang-c that's could be great.</div>

<div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/16 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On Mon, Oct 14, 2013 at 9:48 PM, Alexander Basov <span dir="ltr"><<a href="mailto:coopht@gmail.com" target="_blank">coopht@gmail.com</a>></span> wrote:<br>

</div><div class="gmail_extra"><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello.<div>Could somebody help me with macro expansion?</div><div><br></div><div>I have a header with the following macroses defined:</div>


<div><br></div><div>#define foo(x) x + 2</div><div>#define A 1</div>



<div>#define B foo(A)</div><div><br></div><div>And I need get the following map:</div><div>A = 1</div><div>B = 3</div><div><br></div><div>How can I do it?</div></div></blockquote><div><br></div></div><div>One way:</div><div>

<br>
</div><div>#include "your_header.h"</div><div><br></div><div>int main() {</div><div>  printf("A = %d\nB = %d\n", A, B);</div><div>  return 0;</div><div>}</div><div><br></div><div>What additional constraints do you have? Do you need to do this using the Clang C++ API for some reason? Do you know in advance the names of the macros that you want to evaluate?</div>


<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div dir="ltr"><div>I'm ale to get list of MacroInfo * classes with PPCallbacks or get it with Preprocessor::macro_begin() iterator, but I don't know how to get expaneded value.</div>




<div><br></div><div>Thank you in advance.</div><span><font color="#888888"><div><div><br></div>-- <br>Alexander<br>


</div></font></span></div>
<br></div><div class="im">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></div></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Alexander<br>
</div>