compiling from memory buffer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

compiling from memory buffer

Jochen Wilhelmy
Hi!

To compile from file I do:
const clang::FileEntry* file = fileManager->getFile(fileName);
sourceManager->createMainFileID(file, clang::SourceLocation());

To compile from memory buffer I do:
llvm::MemoryBuffer* buffer = llvm::MemoryBuffer::getMemBuffer(str);
sourceManager->createFileIDForMemBuffer(buffer);

but this asserts in SourceManager.h
in SLocEntry::getFile():
assert(isFile() && "Not a file SLocEntry!");

Whan am I doing wrong?

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: compiling from memory buffer

Demon Insight
Try
        sourceManager->createMainFileIDForMemBuffer (buffer);

HTH,
Vlad

On May 7, 2010, at 1:26 PM, Jochen Wilhelmy wrote:

> Hi!
>
> To compile from file I do:
> const clang::FileEntry* file = fileManager->getFile(fileName);
> sourceManager->createMainFileID(file, clang::SourceLocation());
>
> To compile from memory buffer I do:
> llvm::MemoryBuffer* buffer = llvm::MemoryBuffer::getMemBuffer(str);
> sourceManager->createFileIDForMemBuffer(buffer);
>
> but this asserts in SourceManager.h
> in SLocEntry::getFile():
> assert(isFile() && "Not a file SLocEntry!");
>
> Whan am I doing wrong?
>
> -Jochen
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev