diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-03-26 22:32:06 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-03-26 22:32:06 +0000 |
commit | db8a742206749b2677c78d0125a21968a7df37b3 (patch) | |
tree | 91edaf8086e0428cd113bb6ca9b5e1e0b0ca0486 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 1da7eac87c15662f808f69e260e3ec47923c28f6 (diff) | |
download | llvm-db8a742206749b2677c78d0125a21968a7df37b3.zip llvm-db8a742206749b2677c78d0125a21968a7df37b3.tar.gz llvm-db8a742206749b2677c78d0125a21968a7df37b3.tar.bz2 |
Basic: Return a reference from FileManager::getVirtualFileSystem, NFC
FileManager constructs a VFS in its constructor if it isn't passed one,
and there's no way to reset it. Make that contract clear by returning a
reference from its accessor.
https://reviews.llvm.org/D59388
llvm-svn: 357038
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 6c82a6e..559bdb3 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -169,7 +169,7 @@ static void collectIncludePCH(CompilerInstance &CI, std::error_code EC; SmallString<128> DirNative; llvm::sys::path::native(PCHDir->getName(), DirNative); - llvm::vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem(); + llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem(); SimpleASTReaderListener Validator(CI.getPreprocessor()); for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd; Dir != DirEnd && !EC; Dir.increment(EC)) { @@ -296,7 +296,7 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts, FileManager *CompilerInstance::createFileManager( IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) { if (!VFS) - VFS = FileMgr ? FileMgr->getVirtualFileSystem() + VFS = FileMgr ? &FileMgr->getVirtualFileSystem() : createVFSFromCompilerInvocation(getInvocation(), getDiagnostics()); assert(VFS && "FileManager has no VFS?"); |