[cfe-dev] clang-interpreter example and in-memory buffer

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue May 28 15:49:06 PDT 2013


On May 25, 2013, at 10:00 AM, Adam Seering <aseering at gmail.com> wrote:

> Hi all,
> 	I'm new to libclang/etc; I'm trying to do something very similar to what the "clang-interpreter" example is doing, except I'm playing with generating the .cpp file dynamically.
> 
> 	I could write it out to a temp file, but that means dealing with temp files...  I already have the content I want in a string in memory.  I'm just wondering if there's a reasonably-simple way to pass the file data in directly rather than actually writing it to a file?  Any pointers?

clang_parseTranslationUnit from libclang provides the option to pass source files via memory buffers ("unsaved_files" parameter).
You can "follow" its code path to see how this can be done programmatically.

> 
> Thanks,
> Adam
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list