compiling from memory buffer

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

Try
  sourceManager->createMainFileIDForMemBuffer (buffer);

HTH,
Vlad