summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2019-03-26 22:18:52 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2019-03-26 22:18:52 +0000
commit1da7eac87c15662f808f69e260e3ec47923c28f6 (patch)
tree200e20c53a6506ef729d433f6587de98937af73d /clang/lib/Frontend/CompilerInstance.cpp
parent19c45546fc70d705ce3b470fca4289f33d0cdc20 (diff)
downloadbcm5719-llvm-1da7eac87c15662f808f69e260e3ec47923c28f6.tar.gz
bcm5719-llvm-1da7eac87c15662f808f69e260e3ec47923c28f6.zip
Frontend: Remove CompilerInstance::VirtualFileSystem, NFC
Remove CompilerInstance::VirtualFileSystem and CompilerInstance::setVirtualFileSystem, instead relying on the VFS in the FileManager. CompilerInstance and its clients already went to some trouble to make these match. Now they are guaranteed to match. As part of this, I added a VFS parameter (defaults to nullptr) to CompilerInstance::createFileManager, to avoid repeating construction logic in clients that just wanted to customize the VFS. https://reviews.llvm.org/D59377 llvm-svn: 357037
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index e7385962994..6c82a6e9532 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -89,10 +89,6 @@ void CompilerInstance::setAuxTarget(TargetInfo *Value) { AuxTarget = Value; }
void CompilerInstance::setFileManager(FileManager *Value) {
FileMgr = Value;
- if (Value)
- VirtualFileSystem = Value->getVirtualFileSystem();
- else
- VirtualFileSystem.reset();
}
void CompilerInstance::setSourceManager(SourceManager *Value) {
@@ -297,13 +293,14 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
// File Manager
-FileManager *CompilerInstance::createFileManager() {
- if (!hasVirtualFileSystem()) {
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
- createVFSFromCompilerInvocation(getInvocation(), getDiagnostics());
- setVirtualFileSystem(VFS);
- }
- FileMgr = new FileManager(getFileSystemOpts(), VirtualFileSystem);
+FileManager *CompilerInstance::createFileManager(
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
+ if (!VFS)
+ VFS = FileMgr ? FileMgr->getVirtualFileSystem()
+ : createVFSFromCompilerInvocation(getInvocation(),
+ getDiagnostics());
+ assert(VFS && "FileManager has no VFS?");
+ FileMgr = new FileManager(getFileSystemOpts(), std::move(VFS));
return FileMgr.get();
}
@@ -1101,8 +1098,6 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
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.setFileManager(&ImportingInstance.getFileManager());
OpenPOWER on IntegriCloud