[cfe-dev] read AST from memory buffer, LoadFromASTFile?

Alejandro Jimenez whilealex at gmail.com
Fri Jan 31 12:25:19 PST 2014


Hi clangers!

 I am trying to read an AST file from a memory buffer, here is my approach,
but is not working.

  ASTUnit::RemappedFile theFile;
  theFile.first = "myFileName.ast";
  theFile.second = llvm::MemoryBuffer::getMemBufferCopy(myVirtualString,
"someBufferName");


  // Import AST from virtual file using this remapped file.
  llvm::OwningPtr<clang::ASTUnit>
CUnit(ASTUnit::LoadFromASTFile("myFileName.ast", &ci2.getDiagnostics(),
ci2.getFileSystemOpts(), false, &theFile, 1));

But this is returning NULL on ASTUnit, does anyone know how to fill this
ASTUnit with a virtual buffer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140131/e0ab1a85/attachment.html>


More information about the cfe-dev mailing list