<div dir="ltr">On Tue, Aug 13, 2013 at 11:17 AM, George Kastrinis <span dir="ltr"><<a href="mailto:george.kastrinis@logicblox.com" target="_blank">george.kastrinis@logicblox.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"><span style="font-family:arial,sans-serif;font-size:13px">Hi all,</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">We are working on a Clang plugin, and we wan to have a way to uniquely identify every declaration in a C++ program. We tried using the following.</div>
<div style="font-family:arial,sans-serif;font-size:13px">(presumed location start, presumed location end, spelling location start, spelling location end, declaration kind)</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">But we still have a problem.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
For example, in /usr/include/x86_64-linux-gnu/bits/cmathcalls.h, line 101 a macro called _MATHCALL is used. If you look at /usr/include/complex.h, line 65 where the macro is defined, you will see that the macro uses other macros inside and create two functions (e.g. cpowf and __cpowf)</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><span style="font-family:arial,sans-serif;font-size:13px">I tried using spelling locations, presumed locations, SourceManager::getExpansionLoc on the spelling location. All give the same locations for cpowf and __cpowf.</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Is there any way to achieve what I try to do here?</div><div style="font-family:arial,sans-serif;font-size:13px"></div></div></blockquote></div><br></div>
<div class="gmail_extra">If you really need to serialize SourceLocations, you really need to encode the entire macro expansion stack. SourceManager::getImmediateMacroCallerLoc might be helpful here.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">-Eli</div></div>