summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-02-20 21:59:23 +0000
committerBen Langmuir <blangmuir@apple.com>2014-02-20 21:59:23 +0000
commitc8130a74f498c5ca3d1d6276df392bae337cf221 (patch)
tree04fd5f2ab091ffba1896562844e19ef94baddea4 /clang/lib/Frontend/CompilerInstance.cpp
parent37eb422f69e22490396a45cc65de93ccc75ffa2d (diff)
downloadbcm5719-llvm-c8130a74f498c5ca3d1d6276df392bae337cf221.tar.gz
bcm5719-llvm-c8130a74f498c5ca3d1d6276df392bae337cf221.zip
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. llvm-svn: 201818
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 61fe26c9222..df0095205c3 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/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?
OpenPOWER on IntegriCloud