aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/VirtualFileSystemTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-08 14:58:46 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-08 17:33:46 -0800
commita22eda548b8e1f9362018dec194af0ca91b35da0 (patch)
treedeeb0af688f34dfd07446da8eea87866fefe33ba /llvm/unittests/Support/VirtualFileSystemTest.cpp
parent5207f19d103dc3e0ec974fa64d2c031d84d497a8 (diff)
downloadllvm-a22eda548b8e1f9362018dec194af0ca91b35da0.zip
llvm-a22eda548b8e1f9362018dec194af0ca91b35da0.tar.gz
llvm-a22eda548b8e1f9362018dec194af0ca91b35da0.tar.bz2
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
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
-rw-r--r--llvm/unittests/Support/VirtualFileSystemTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index 4cc209d..1b574b36 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1292,7 +1292,7 @@ public:
++Test->NumDiagnostics;
}
- IntrusiveRefCntPtr<vfs::FileSystem>
+ std::unique_ptr<vfs::FileSystem>
getFromYAMLRawString(StringRef Content,
IntrusiveRefCntPtr<vfs::FileSystem> ExternalFS) {
std::unique_ptr<MemoryBuffer> Buffer = MemoryBuffer::getMemBuffer(Content);
@@ -1300,7 +1300,7 @@ public:
ExternalFS);
}
- IntrusiveRefCntPtr<vfs::FileSystem> getFromYAMLString(
+ std::unique_ptr<vfs::FileSystem> getFromYAMLString(
StringRef Content,
IntrusiveRefCntPtr<vfs::FileSystem> ExternalFS = new DummyFileSystem()) {
std::string VersionPlusContent("{\n 'version':0,\n");