diff options
author | Alex Lorenz <arphaman@gmail.com> | 2021-04-26 17:01:51 -0700 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2021-04-26 17:05:22 -0700 |
commit | 2509f9fbad0d37e3e5fea934c0ae7af3877ba4ae (patch) | |
tree | e359fb29df10d02bc7a11412218047f2aed74986 /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | a2a3ca8d97962d90443ee758e47877e15d7e3832 (diff) | |
download | llvm-2509f9fbad0d37e3e5fea934c0ae7af3877ba4ae.zip llvm-2509f9fbad0d37e3e5fea934c0ae7af3877ba4ae.tar.gz llvm-2509f9fbad0d37e3e5fea934c0ae7af3877ba4ae.tar.bz2 |
[clang] Don't crash when loading invalid VFS for the module dep collector
The VFS is null when it's invalid so return early in collectVFSFromYAML.
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index deb0f37..dd820c1 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2127,6 +2127,8 @@ void vfs::collectVFSFromYAML(std::unique_ptr<MemoryBuffer> Buffer, std::unique_ptr<RedirectingFileSystem> VFS = RedirectingFileSystem::create( std::move(Buffer), DiagHandler, YAMLFilePath, DiagContext, std::move(ExternalFS)); + if (!VFS) + return; ErrorOr<RedirectingFileSystem::LookupResult> RootResult = VFS->lookupPath("/"); if (!RootResult) |