[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] Using the clang::SourceManager's after calling
From:       steve naroff <snaroff () apple ! com>
Date:       2008-10-30 12:00:02
Message-ID: C0BD212D-FE41-452E-8452-9F5A1C6B5698 () apple ! com
[Download RAW message or body]


On Oct 30, 2008, at 7:43 AM, Paolo Bolzoni wrote:

>
> I'd like to use clang's AST for global (i.e., compilation-unit-wide)
> analyses.  Thus, I plan to make a clang::ASTConsumer derived class
> that collects everything I need and finally analyze the data as a
> whole.
>
> After the analysis, in order to produce interesting output messages
> I need to refer to the source files using the clang::SourceLocation.
>
> As far as I understand, the clang::SourceLocation(s) are just integers
> references that only make sense with respect to the  
> clang::SourceManager,
> which is part of the preprocessor I have to make to parse the file and
> obtain the AST.
>
> Now, if I use: clang::ParseAST(&PP, *C, false, false) (overriding the
> FreeMemory default parameter) after completing parsing is it true
> that the clang::SourceManager inside PP will still contains all the
> info about the last parsed compilation unit?
>

Should be fine.

> If so, can I just to keep copies of clang::SourceLocation(s) and use
> them with that source manager?
>

Yes.

snaroff

> pb
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic