@@ -227,10 +227,11 @@ bool runToolOnCodeWithArgs(
227
227
const Twine &ToolName,
228
228
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
229
229
const FileContentMappings &VirtualMappedFiles) {
230
- llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem (
231
- new llvm::vfs::OverlayFileSystem (llvm::vfs::getRealFileSystem ()));
232
- llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem (
233
- new llvm::vfs::InMemoryFileSystem);
230
+ auto OverlayFileSystem =
231
+ llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
232
+ llvm::vfs::getRealFileSystem ());
233
+ auto InMemoryFileSystem =
234
+ llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
234
235
OverlayFileSystem->pushOverlay (InMemoryFileSystem);
235
236
236
237
SmallString<1024 > CodeStorage;
@@ -403,7 +404,7 @@ bool ToolInvocation::run() {
403
404
}
404
405
405
406
const std::unique_ptr<driver::Driver> Driver (
406
- newDriver (&*Diagnostics, BinaryName, & Files->getVirtualFileSystem ()));
407
+ newDriver (&*Diagnostics, BinaryName, Files->getVirtualFileSystemPtr ()));
407
408
// The "input file not found" diagnostics from the driver are useful.
408
409
// The driver is only aware of the VFS working directory, but some clients
409
410
// change this at the FileManager level instead.
@@ -473,8 +474,10 @@ ClangTool::ClangTool(const CompilationDatabase &Compilations,
473
474
IntrusiveRefCntPtr<FileManager> Files)
474
475
: Compilations(Compilations), SourcePaths(SourcePaths),
475
476
PCHContainerOps(std::move(PCHContainerOps)),
476
- OverlayFileSystem(new llvm::vfs::OverlayFileSystem(std::move(BaseFS))),
477
- InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem),
477
+ OverlayFileSystem(llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
478
+ std::move (BaseFS))),
479
+ InMemoryFileSystem(
480
+ llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>()),
478
481
Files(Files ? Files
479
482
: new FileManager(FileSystemOptions(), OverlayFileSystem)) {
480
483
OverlayFileSystem->pushOverlay (InMemoryFileSystem);
@@ -692,10 +695,11 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
692
695
IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS) {
693
696
std::vector<std::unique_ptr<ASTUnit>> ASTs;
694
697
ASTBuilderAction Action (ASTs);
695
- llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem (
696
- new llvm::vfs::OverlayFileSystem (std::move (BaseFS)));
697
- llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem (
698
- new llvm::vfs::InMemoryFileSystem);
698
+ auto OverlayFileSystem =
699
+ llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
700
+ std::move (BaseFS));
701
+ auto InMemoryFileSystem =
702
+ llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
699
703
OverlayFileSystem->pushOverlay (InMemoryFileSystem);
700
704
llvm::IntrusiveRefCntPtr<FileManager> Files (
701
705
new FileManager (FileSystemOptions (), OverlayFileSystem));
0 commit comments