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/Sema/SemaCodeComplete.cpp | |
parent | 1da7eac87c15662f808f69e260e3ec47923c28f6 (diff) | |
download | bcm5719-llvm-db8a742206749b2677c78d0125a21968a7df37b3.tar.gz bcm5719-llvm-db8a742206749b2677c78d0125a21968a7df37b3.zip |
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/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 0946a24676d..2412d919ec9 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -8379,7 +8379,8 @@ void Sema::CodeCompleteIncludedFile(llvm::StringRef Dir, bool Angled) { // We need the native slashes for the actual file system interactions. SmallString<128> NativeRelDir = StringRef(RelDir); llvm::sys::path::native(NativeRelDir); - auto FS = getSourceManager().getFileManager().getVirtualFileSystem(); + llvm::vfs::FileSystem &FS = + getSourceManager().getFileManager().getVirtualFileSystem(); ResultBuilder Results(*this, CodeCompleter->getAllocator(), CodeCompleter->getCodeCompletionTUInfo(), @@ -8425,7 +8426,7 @@ void Sema::CodeCompleteIncludedFile(llvm::StringRef Dir, bool Angled) { std::error_code EC; unsigned Count = 0; - for (auto It = FS->dir_begin(Dir, EC); + for (auto It = FS.dir_begin(Dir, EC); !EC && It != llvm::vfs::directory_iterator(); It.increment(EC)) { if (++Count == 2500) // If we happen to hit a huge directory, break; // bail out early so we're not too slow. |