[cfe-dev] Parse AST several times

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 2 12:10:21 PST 2013


On Jan 2, 2013, at 11:49 AM, Mohammad Adil <madil90 at gmail.com> wrote:

> Hi,
>    Is it possible that once I have done the parsing, instead of a writing to a file, i go on to compile the contents of the buffer in my rewriter?

Yes, this is achieved via SourceManager::overrideFileContents().
Depending on how you do the parsing, you may just need to add the remapping at PreprocessorOptions::RemappedFileBuffers.

> 
> Regards,
> Adil
> 
> 
> On Thu, Jan 3, 2013 at 12:28 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> How about reparsing with a new SourceManager, Preprocessor etc.
> For example, use a new ASTUnit or CompilerInstance, depending on how you do the parsing.
> 
> On Jan 1, 2013, at 4:13 AM, madil90 <madil90 at gmail.com> wrote:
> 
> > Hi,
> >   I am creating and parsing an AST. During this parsing, I am making some
> > changes(using rewriter) to the file. I want to now update the AST and parse
> > the AST conforming to the edited file. Unfortunately, the
> > sourcemanager.createMianFileID(FileEntry) gives an error saying
> > "MainFileID.isInvalid() && MainFileID already exists". How can I parse the
> > AST several time, while updating the AST after each parsing.
> >
> > Regards,
> > Adil
> > LUMS SSE
> >
> >
> >
> > --
> > View this message in context: http://clang-developers.42468.n3.nabble.com/Parse-AST-several-times-tp4029276.html
> > Sent from the Clang Developers mailing list archive at Nabble.com.
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 
> 
> 
> -- 
> Mohammad Adil
> LUMS SSE

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


More information about the cfe-dev mailing list