[cfe-dev] HOW TO GET smallest AST

Peter Stirling peter at pjstirling.plus.com
Thu Mar 19 22:07:43 PDT 2015


Could you not use the SourceLocation to work out if the declaration was 
in the main file?

On 20/03/15 04:16, Nikola Smiljanic wrote:
> You can't, the AST is built from the preprocessed file. In this 
> specific case you could get away with it by providing a printf 
> declaration and not including stdio.h but this solution doesn't really 
> scale.
>
> On Fri, Mar 20, 2015 at 2:27 PM, kaka <aamen521 at 163.com 
> <mailto:aamen521 at 163.com>> wrote:
>
>
>     a cpp like this:
>     #include<stdio.h>
>     int mian()
>     {
>      printf("aa");
>     }
>
>     when I get the AST of this cpp,
>     All the decl identify ..  in stdio.h
>     included in the AST.
>
>     How Can I get The AST only contain decl I wrote or used.
>
>
>
>
>     --
>     View this message in context:
>     http://clang-developers.42468.n3.nabble.com/HOW-TO-GET-smallest-AST-tp4044597.html
>     Sent from the Clang Developers mailing list archive at Nabble.com.
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150320/8da02995/attachment.html>


More information about the cfe-dev mailing list