<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 17, 2014 at 5:51 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</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">It appears that <a href="http://nabble.com" target="_blank">nabble.com</a> failed to send your AST dump and code snippet to the mailing list. Snippets listed below.<div class="gmail_extra">
<br><div class="gmail_quote"><div class="">On Mon, Mar 17, 2014 at 4:13 PM, Etienne <span dir="ltr"><<a href="mailto:eollivier@bsu.edu" target="_blank">eollivier@bsu.edu</a>></span> wrote:<br>
<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">Hello,<br>
I am working on a project where I am using the RecursiveASTVisitor to get<br>
metrics from files.<br>
I would like to exclude the parts of the AST that are from included files,<br>
so the metrics I get concern only the file I want to analyze.<br>
I tried to check the location of the Statements, Declarations etc and<br>
exclude them if their location is not the file I am analyzing.<br>
However this solution doesn't really work.<br>
As an example if I call a function from cstdarg:<br></blockquote><div><br></div></div><div>va_start(args, count);</div></div></div></div></blockquote><div><br></div><div>va_start is a macro, not a function.</div><div><br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class=""><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">
As the dump shows, the location of the CallExpr is in stdarg.h so my method<br>
excludes it, even if I would like to keep it since it appears in my source<br>
file<br></blockquote><div><br></div></div><div><div>-CallExpr 0x6080720 </**/../lib/clang/3.5/include/stdarg.h:33:29, col:57> 'void'</div><div> |-ImplicitCastExpr 0x6080708 <col:29> 'void (*)(__va_list_tag *, ...)' <BuiltinFnToFnPtr></div>
<div> | `-DeclRefExpr 0x6080630 <col:29> '<builtin fn type>' Function 0x60804f0 '__builtin_va_start' 'void (__va_list_tag *, ...)'</div><div> |-ImplicitCastExpr 0x6080758 <myfile.cpp:68:14> '__va_list_tag *' <ArrayToPointerDecay></div>
<div> | `-DeclRefExpr 0x6080658 <col:14> 'va_list':'__va_list_tag [1]' lvalue Var 0x607fe40 'args' 'va_list':'__va_list_tag [1]'</div><div> `-DeclRefExpr 0x6080680 <col:20> 'int' lvalue ParmVar 0x607fc00 'count' 'int'</div>
</div><div class=""><div> </div><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">
Would you have a suggestion to avoid this problem or an other method that<br>
could work?<br></blockquote></div></div></div></div></blockquote><div><br></div><div>You can ask the SourceManager for the expansion location of each source location to map to the place where a macro was expanded from, if any.</div>
</div></div></div>