<div dir="ltr">Great. The combination of SourceManager::getDecomposedIncludedLoc and SourceManager::getImmediateMacroCallerLoc (in a loop) (along with the spelling location and the presumed location) seems to work for all the cases that I tried. I just accumulate the information in a string and get a hash afterwards.<div>
<br></div><div>Thank you for your help.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 14, 2013 at 12:53 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<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 Wed, Aug 14, 2013 at 8:36 AM, George Kastrinis <span dir="ltr"><<a href="mailto:george.kastrinis@logicblox.com" target="_blank">george.kastrinis@logicblox.com</a>></span> wrote:<br>
</div><div class="gmail_extra">
<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks. Yeah, SourceManager::getImmediateMacroCallerLoc is what we though might help to get all the expansion stack and I think it helped in some cases. But now we have the following issue (again from the same math header!). Say you have in file a.cpp<div>
<br></div><div><div>#define __THROW throw ()</div><div><br></div><div>#define __MATHCALL(function, args)<span style="white-space:pre-wrap"> </span>\</div><div> __MATHDECL (double,function, args)</div><div>#define __MATHDECL(type, function, args) \</div>
<div> __MATHDECL_1(type, function, args); \</div><div> __MATHDECL_1(type, __ ## function, args)</div><div>#define __MATHDECL_1(type, function, args) \</div><div> extern type __MATH_PRECNAME(function) args __THROW</div>
<div><br></div><div>#define __MATH_PRECNAME(name)<span style="white-space:pre-wrap"> </span>name</div><div>#include "b.h"</div><div>#undef __MATH_PRECNAME</div><div><br></div><div>#define __MATH_PRECNAME(name)<span style="white-space:pre-wrap"> </span>name##f</div>
<div>#include "b.h"</div><div>#undef __MATH_PRECNAME</div></div><div><br></div><div>and in b.h</div><div><br></div><div>__MATHCALL (cpow, (double __x, double __y));<br></div><div><br></div><div>This will create 4 functions (cpow, __cpow, cpowf, __cpowf). Using SourceManager::getImmediateMacroCallerLoc we are able to differentiate for example cpow and __cpow. But there is still an issue with cpow and cpowf (and with __cpow and __cpowf). Those pairs have the same locations even when getting the whole expansion macro.</div>
<div><br></div><div>Is there anything we can do to handle this case?</div><div><br><br></div></div></blockquote><div><br></div></div><div>I think you also need to track the include stack. SourceManager::getDecomposedIncludedLoc might be useful here.<span class="HOEnZb"><font color="#888888"><br>
<br></font></span></div><span class="HOEnZb"><font color="#888888"><div>-Eli <br></div></font></span></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><br>George Kastrinis<br><a href="http://gkastrinis.info/" target="_blank">http://gkastrinis.info/</a><br></div>
</div>