<div dir="ltr">Hey Sam. Thanks for the suggestion.<div><br></div><div>We finally found a way to handle Declarations by getting the complete expansion stack (all the locations of macros that are part of the final result) as well as the include locations.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 15, 2013 at 1:10 PM, Sam Parker <span dir="ltr"><<a href="mailto:S.Parker3@lboro.ac.uk" target="_blank">S.Parker3@lboro.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi George,<br>
<br>
I was having a similar problem with source locations and macros, but
I was doing source-to-source transformations. I don't know if it
will help you, but I first expanded all the macros using a
RewriteMacrosAction, and that gave me valid SourceLocations to
rewrite to.<br>
<br>
Regards,<br>
Sam<br>
<br>
<div>On 13/08/13 19:12, George Kastrinis
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>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>(presumed location start, presumed location end, spelling
location start, spelling location end, declaration kind)</div>
<div><br>
</div>
<div>But we still have a problem.</div>
<div><br>
</div>
<div>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><br>
</div>
I tried using spelling locations, presumed locations,
SourceManager::getExpansionLoc on the spelling location. All
give the same locations for cpowf and __cpowf.
<div><br>
</div>
<div>Is there any way to achieve what I try to do here?</div>
<div><br>
</div>
<div>Thanks for your time<span class="HOEnZb"><font color="#888888"><br>
<div>
<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>
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
cfe-dev mailing list
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
</font></span></blockquote>
<br>
</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>