diff options
| author | Ben Langmuir <blangmuir@apple.com> | 2014-02-20 21:59:23 +0000 |
|---|---|---|
| committer | Ben Langmuir <blangmuir@apple.com> | 2014-02-20 21:59:23 +0000 |
| commit | d7596d64125a962565452d5f7f6bac545ec5a082 (patch) | |
| tree | 48db574f2bb6fed3725cc4148a57f4be48ce9c8c /lib/Frontend/CompilerInstance.cpp | |
| parent | 9bce94e59ca9b2afb119f11833227ca6a4eda0ef (diff) | |
| download | clang-d7596d64125a962565452d5f7f6bac545ec5a082.tar.gz clang-d7596d64125a962565452d5f7f6bac545ec5a082.tar.bz2 clang-d7596d64125a962565452d5f7f6bac545ec5a082.tar.xz | |
Recommit virtual file system
Previously reverted in r201755 due to causing an assertion failure.
I've removed the offending assertion, and taught the CompilerInstance to
create a default virtual file system inside createFileManager. In the
future, we should be able to reach into the CompilerInvocation to
customize this behaviour without breaking clients that don't care.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
| -rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 61fe26c922..df0095205c 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -79,6 +79,10 @@ void CompilerInstance::setTarget(TargetInfo *Value) { void CompilerInstance::setFileManager(FileManager *Value) { FileMgr = Value; + if (Value) + VirtualFileSystem = Value->getVirtualFileSystem(); + else + VirtualFileSystem.reset(); } void CompilerInstance::setSourceManager(SourceManager *Value) { @@ -197,7 +201,11 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts, // File Manager void CompilerInstance::createFileManager() { - FileMgr = new FileManager(getFileSystemOpts()); + if (!hasVirtualFileSystem()) { + // TODO: choose the virtual file system based on the CompilerInvocation. + setVirtualFileSystem(vfs::getRealFileSystem()); + } + FileMgr = new FileManager(getFileSystemOpts(), VirtualFileSystem); } // Source Manager @@ -867,6 +875,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? |
