VFS: Return new file systems as uniquely owned when possible, almost NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 8 Dec 2020 22:58:46 +0000 (14:58 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 9 Dec 2020 01:33:46 +0000 (17:33 -0800)
commita22eda548b8e1f9362018dec194af0ca91b35da0
treedeeb0af688f34dfd07446da8eea87866fefe33ba
parent5207f19d103dc3e0ec974fa64d2c031d84d497a8
VFS: Return new file systems as uniquely owned when possible, almost NFC

Uniformly return uniquely-owned filesystems from VFS creation APIs. The
one exception is `getRealFileSystem`, which has a single instance and
needs to be shared.

This is almost NFC, except that it fixes a memory leak in
`vfs::collectVFSFromYAML()`.

Depends on https://reviews.llvm.org/D92888

Differential Revision: https://reviews.llvm.org/D92890
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp