[cfe-dev] compiling from memory buffer

Jochen Wilhelmy j.wilhelmy at arcor.de
Fri May 7 11:26:36 PDT 2010


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




More information about the cfe-dev mailing list