Initial implementation of virtual file system

This adds the minimum virtual file system support to start migrating
FileManager onto the VFS.

Originally discussed here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html

Differential Revision: http://llvm-reviews.chandlerc.com/D2745

llvm-svn: 201618
This commit is contained in:
Ben Langmuir
2014-02-19 00:10:30 +00:00
parent 064eaba99c
commit 090610d37a
16 changed files with 423 additions and 107 deletions

View File

@@ -194,9 +194,14 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
return Diags;
}
void CompilerInstance::createVirtualFileSystem() {
VirtualFileSystem = vfs::getRealFileSystem();
}
// File Manager
void CompilerInstance::createFileManager() {
assert(hasVirtualFileSystem() && "expected virtual file system");
FileMgr = new FileManager(getFileSystemOpts());
}
@@ -867,6 +872,8 @@ static void compileModule(CompilerInstance &ImportingInstance,
ImportingInstance.getDiagnosticClient()),
/*ShouldOwnClient=*/true);
Instance.setVirtualFileSystem(&ImportingInstance.getVirtualFileSystem());
// Note that this module is part of the module build stack, so that we
// can detect cycles in the module graph.
Instance.createFileManager(); // FIXME: Adopt file manager from importer?