Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/include/clang/Frontend/CompilerInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ class CompilerInstance : public ModuleLoader {
/// @{

llvm::vfs::FileSystem &getVirtualFileSystem() const;
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
getVirtualFileSystemPtr() const;

/// @}
/// @name File Manager
Expand Down
10 changes: 4 additions & 6 deletions clang/lib/Basic/SourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2366,18 +2366,16 @@ size_t SourceManager::getDataStructureSizes() const {

SourceManagerForFile::SourceManagerForFile(StringRef FileName,
StringRef Content) {
// This is referenced by `FileMgr` and will be released by `FileMgr` when it
// is deleted.
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
InMemoryFileSystem->addFile(
FileName, 0,
llvm::MemoryBuffer::getMemBuffer(Content, FileName,
/*RequiresNullTerminator=*/false));
// This is passed to `SM` as reference, so the pointer has to be referenced
// in `Environment` so that `FileMgr` can out-live this function scope.
FileMgr =
std::make_unique<FileManager>(FileSystemOptions(), InMemoryFileSystem);
FileMgr = std::make_unique<FileManager>(FileSystemOptions(),
std::move(InMemoryFileSystem));
DiagOpts = std::make_unique<DiagnosticOptions>();
// This is passed to `SM` as reference, so the pointer has to be referenced
// by `Environment` due to the same reason above.
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CodeGenAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
CI.getPreprocessor());

std::unique_ptr<BackendConsumer> Result(new BackendConsumer(
CI, BA, &CI.getVirtualFileSystem(), *VMContext, std::move(LinkModules),
CI, BA, CI.getVirtualFileSystemPtr(), *VMContext, std::move(LinkModules),
InFile, std::move(OS), CoverageInfo));
BEConsumer = Result.get();

Expand Down Expand Up @@ -1156,7 +1156,7 @@ void CodeGenAction::ExecuteAction() {

// Set clang diagnostic handler. To do this we need to create a fake
// BackendConsumer.
BackendConsumer Result(CI, BA, &CI.getVirtualFileSystem(), *VMContext,
BackendConsumer Result(CI, BA, CI.getVirtualFileSystemPtr(), *VMContext,
std::move(LinkModules), "", nullptr, nullptr,
TheModule.get());

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class PCHContainerGenerator : public ASTConsumer {
: CI(CI), Diags(CI.getDiagnostics()), MainFileName(MainFileName),
OutputFileName(OutputFileName), Ctx(nullptr),
MMap(CI.getPreprocessor().getHeaderSearchInfo().getModuleMap()),
FS(&CI.getVirtualFileSystem()),
FS(CI.getVirtualFileSystemPtr()),
HeaderSearchOpts(CI.getHeaderSearchOpts()),
PreprocessorOpts(CI.getPreprocessorOpts()),
TargetOpts(CI.getTargetOpts()), LangOpts(CI.getLangOpts()),
Expand Down
9 changes: 5 additions & 4 deletions clang/lib/Frontend/ASTUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCompilerInvocation(

if (AST->LoadFromCompilerInvocation(std::move(PCHContainerOps),
PrecompilePreambleAfterNParses,
&AST->FileMgr->getVirtualFileSystem()))
AST->FileMgr->getVirtualFileSystemPtr()))
return nullptr;
return AST;
}
Expand Down Expand Up @@ -1895,7 +1895,7 @@ bool ASTUnit::Reparse(std::shared_ptr<PCHContainerOperations> PCHContainerOps,

if (!VFS) {
assert(FileMgr && "FileMgr is null on Reparse call");
VFS = &FileMgr->getVirtualFileSystem();
VFS = FileMgr->getVirtualFileSystemPtr();
}

clearFileLevelDecls();
Expand Down Expand Up @@ -2321,7 +2321,8 @@ void ASTUnit::CodeComplete(
std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer;
if (Preamble && Line > 1 && hasSameUniqueID(File, OriginalSourceFile)) {
OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(
PCHContainerOps, Inv, &FileMgr.getVirtualFileSystem(), false, Line - 1);
PCHContainerOps, Inv, FileMgr.getVirtualFileSystemPtr(), false,
Line - 1);
}

// If the main file has been overridden due to the use of a preamble,
Expand All @@ -2331,7 +2332,7 @@ void ASTUnit::CodeComplete(
"No preamble was built, but OverrideMainBuffer is not null");

IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
&FileMgr.getVirtualFileSystem();
FileMgr.getVirtualFileSystemPtr();
Preamble->AddImplicitPreamble(Clang->getInvocation(), VFS,
OverrideMainBuffer.get());
// FIXME: there is no way to update VFS if it was changed by
Expand Down
9 changes: 7 additions & 2 deletions clang/lib/Frontend/CompilerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ llvm::vfs::FileSystem &CompilerInstance::getVirtualFileSystem() const {
return getFileManager().getVirtualFileSystem();
}

llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
CompilerInstance::getVirtualFileSystemPtr() const {
return getFileManager().getVirtualFileSystemPtr();
}

void CompilerInstance::setFileManager(FileManager *Value) {
FileMgr = Value;
}
Expand Down Expand Up @@ -375,7 +380,7 @@ IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
FileManager *CompilerInstance::createFileManager(
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
if (!VFS)
VFS = FileMgr ? &FileMgr->getVirtualFileSystem()
VFS = FileMgr ? FileMgr->getVirtualFileSystemPtr()
: createVFSFromCompilerInvocation(getInvocation(),
getDiagnostics());
assert(VFS && "FileManager has no VFS?");
Expand Down Expand Up @@ -1218,7 +1223,7 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
} else if (FrontendOpts.ModulesShareFileManager) {
Instance.setFileManager(&getFileManager());
} else {
Instance.createFileManager(&getVirtualFileSystem());
Instance.createFileManager(getVirtualFileSystemPtr());
}

if (ThreadSafeConfig) {
Expand Down
6 changes: 2 additions & 4 deletions clang/lib/Frontend/PrecompiledPreamble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ createVFSOverlayForPreamblePCH(StringRef PCHFilename,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
// We want only the PCH file from the real filesystem to be available,
// so we create an in-memory VFS with just that and overlay it on top.
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> PCHFS(
new llvm::vfs::InMemoryFileSystem());
auto PCHFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
PCHFS->addFile(PCHFilename, 0, std::move(PCHBuffer));
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> Overlay(
new llvm::vfs::OverlayFileSystem(VFS));
auto Overlay = llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(VFS);
Overlay->pushOverlay(PCHFS);
return Overlay;
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Tooling/Core/Replacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@ llvm::Expected<std::string> applyAllReplacements(StringRef Code,
if (Replaces.empty())
return Code.str();

IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
FileManager Files(FileSystemOptions(), InMemoryFileSystem);
DiagnosticOptions DiagOpts;
DiagnosticsEngine Diagnostics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ DependencyScanningWorker::DependencyScanningWorker(

switch (Service.getMode()) {
case ScanningMode::DependencyDirectivesScan:
DepFS =
new DependencyScanningWorkerFilesystem(Service.getSharedCache(), FS);
DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
Service.getSharedCache(), FS);
BaseFS = DepFS;
break;
case ScanningMode::CanonicalPreprocessing:
Expand Down
26 changes: 15 additions & 11 deletions clang/lib/Tooling/Tooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ bool runToolOnCodeWithArgs(
const Twine &ToolName,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
const FileContentMappings &VirtualMappedFiles) {
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem(
new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto OverlayFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
llvm::vfs::getRealFileSystem());
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
OverlayFileSystem->pushOverlay(InMemoryFileSystem);

SmallString<1024> CodeStorage;
Expand Down Expand Up @@ -403,7 +404,7 @@ bool ToolInvocation::run() {
}

const std::unique_ptr<driver::Driver> Driver(
newDriver(&*Diagnostics, BinaryName, &Files->getVirtualFileSystem()));
newDriver(&*Diagnostics, BinaryName, Files->getVirtualFileSystemPtr()));
// The "input file not found" diagnostics from the driver are useful.
// The driver is only aware of the VFS working directory, but some clients
// change this at the FileManager level instead.
Expand Down Expand Up @@ -473,8 +474,10 @@ ClangTool::ClangTool(const CompilationDatabase &Compilations,
IntrusiveRefCntPtr<FileManager> Files)
: Compilations(Compilations), SourcePaths(SourcePaths),
PCHContainerOps(std::move(PCHContainerOps)),
OverlayFileSystem(new llvm::vfs::OverlayFileSystem(std::move(BaseFS))),
InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem),
OverlayFileSystem(llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
std::move(BaseFS))),
InMemoryFileSystem(
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>()),
Files(Files ? Files
: new FileManager(FileSystemOptions(), OverlayFileSystem)) {
OverlayFileSystem->pushOverlay(InMemoryFileSystem);
Expand Down Expand Up @@ -692,10 +695,11 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS) {
std::vector<std::unique_ptr<ASTUnit>> ASTs;
ASTBuilderAction Action(ASTs);
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem(
new llvm::vfs::OverlayFileSystem(std::move(BaseFS)));
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto OverlayFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
std::move(BaseFS));
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
OverlayFileSystem->pushOverlay(InMemoryFileSystem);
llvm::IntrusiveRefCntPtr<FileManager> Files(
new FileManager(FileSystemOptions(), OverlayFileSystem));
Expand Down
8 changes: 4 additions & 4 deletions clang/tools/clang-format/ClangFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ static bool parseLineRange(StringRef Input, unsigned &FromLine,

static bool fillRanges(MemoryBuffer *Code,
std::vector<tooling::Range> &Ranges) {
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
FileManager Files(FileSystemOptions(), InMemoryFileSystem);
DiagnosticOptions DiagOpts;
DiagnosticsEngine Diagnostics(
Expand Down Expand Up @@ -511,8 +511,8 @@ static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
if (OutputXML) {
outputXML(Replaces, FormatChanges, Status, Cursor, CursorPosition);
} else {
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
FileManager Files(FileSystemOptions(), InMemoryFileSystem);

DiagnosticOptions DiagOpts;
Expand Down
2 changes: 1 addition & 1 deletion clang/tools/clang-import-test/clang-import-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ std::unique_ptr<CodeGenerator> BuildCodeGen(CompilerInstance &CI,
llvm::LLVMContext &LLVMCtx) {
StringRef ModuleName("$__module");
return std::unique_ptr<CodeGenerator>(CreateLLVMCodeGen(
CI.getDiagnostics(), ModuleName, &CI.getVirtualFileSystem(),
CI.getDiagnostics(), ModuleName, CI.getVirtualFileSystemPtr(),
CI.getHeaderSearchOpts(), CI.getPreprocessorOpts(), CI.getCodeGenOpts(),
LLVMCtx));
}
Expand Down
9 changes: 5 additions & 4 deletions clang/tools/clang-installapi/ClangInstallAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ static bool run(ArrayRef<const char *> Args, const char *ProgName) {

// Create file manager for all file operations and holding in-memory generated
// inputs.
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem(
new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto OverlayFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(
llvm::vfs::getRealFileSystem());
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
OverlayFileSystem->pushOverlay(InMemoryFileSystem);
IntrusiveRefCntPtr<clang::FileManager> FM(
new FileManager(clang::FileSystemOptions(), OverlayFileSystem));
Expand Down
3 changes: 2 additions & 1 deletion clang/unittests/Analysis/MacroExpansionContextTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ namespace {
class MacroExpansionContextTest : public ::testing::Test {
protected:
MacroExpansionContextTest()
: InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem),
: InMemoryFileSystem(
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>()),
FileMgr(FileSystemOptions(), InMemoryFileSystem),
DiagID(new DiagnosticIDs()),
Diags(DiagID, DiagOpts, new IgnoringDiagConsumer()),
Expand Down
12 changes: 4 additions & 8 deletions clang/unittests/Basic/FileManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ TEST_F(FileManagerTest, makeAbsoluteUsesVFS) {
: StringRef("/");
llvm::sys::path::append(CustomWorkingDir, "some", "weird", "path");

auto FS = IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem>(
new llvm::vfs::InMemoryFileSystem);
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
// setCurrentworkingdirectory must finish without error.
ASSERT_TRUE(!FS->setCurrentWorkingDirectory(CustomWorkingDir));

Expand All @@ -475,8 +474,7 @@ TEST_F(FileManagerTest, makeAbsoluteUsesVFS) {
TEST_F(FileManagerTest, getVirtualFileFillsRealPathName) {
SmallString<64> CustomWorkingDir = getSystemRoot();

auto FS = IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem>(
new llvm::vfs::InMemoryFileSystem);
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
// setCurrentworkingdirectory must finish without error.
ASSERT_TRUE(!FS->setCurrentWorkingDirectory(CustomWorkingDir));

Expand All @@ -501,8 +499,7 @@ TEST_F(FileManagerTest, getVirtualFileFillsRealPathName) {
TEST_F(FileManagerTest, getFileDontOpenRealPath) {
SmallString<64> CustomWorkingDir = getSystemRoot();

auto FS = IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem>(
new llvm::vfs::InMemoryFileSystem);
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
// setCurrentworkingdirectory must finish without error.
ASSERT_TRUE(!FS->setCurrentWorkingDirectory(CustomWorkingDir));

Expand Down Expand Up @@ -533,8 +530,7 @@ TEST_F(FileManagerTest, getBypassFile) {
CustomWorkingDir = "/";
#endif

auto FS = IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem>(
new llvm::vfs::InMemoryFileSystem);
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
// setCurrentworkingdirectory must finish without error.
ASSERT_TRUE(!FS->setCurrentWorkingDirectory(CustomWorkingDir));

Expand Down
3 changes: 2 additions & 1 deletion clang/unittests/Basic/SarifTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static std::string serializeSarifDocument(llvm::json::Object &&Doc) {
class SarifDocumentWriterTest : public ::testing::Test {
protected:
SarifDocumentWriterTest()
: InMemoryFileSystem(new llvm::vfs::InMemoryFileSystem),
: InMemoryFileSystem(
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>()),
FileMgr(FileSystemOptions(), InMemoryFileSystem),
DiagID(new DiagnosticIDs()),
Diags(DiagID, DiagOpts, new IgnoringDiagConsumer()),
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/CodeGen/TestCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct TestCompiler {

CG.reset(CreateLLVMCodeGen(
compiler.getDiagnostics(), "main-module",
&compiler.getVirtualFileSystem(), compiler.getHeaderSearchOpts(),
compiler.getVirtualFileSystemPtr(), compiler.getHeaderSearchOpts(),
compiler.getPreprocessorOpts(), compiler.getCodeGenOpts(), Context));
}

Expand Down
12 changes: 6 additions & 6 deletions clang/unittests/Driver/DXCModeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ static void validateTargetProfile(
TEST(DxcModeTest, TargetProfileValidation) {
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());

IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();

InMemoryFileSystem->addFile("foo.hlsl", 0,
llvm::MemoryBuffer::getMemBuffer("\n"));
Expand Down Expand Up @@ -107,8 +107,8 @@ TEST(DxcModeTest, TargetProfileValidation) {
TEST(DxcModeTest, ValidatorVersionValidation) {
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());

IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();

InMemoryFileSystem->addFile("foo.hlsl", 0,
llvm::MemoryBuffer::getMemBuffer("\n"));
Expand Down Expand Up @@ -210,8 +210,8 @@ TEST(DxcModeTest, ValidatorVersionValidation) {
}

TEST(DxcModeTest, DefaultEntry) {
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();

InMemoryFileSystem->addFile("foo.hlsl", 0,
llvm::MemoryBuffer::getMemBuffer("\n"));
Expand Down
3 changes: 1 addition & 2 deletions clang/unittests/Driver/SanitizerArgsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ class SanitizerArgsTest : public ::testing::Test {
private:
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem>
prepareFS(llvm::ArrayRef<std::string> ExtraFiles) {
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> FS =
new llvm::vfs::InMemoryFileSystem;
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
FS->addFile(ClangBinary, time_t(), llvm::MemoryBuffer::getMemBuffer(""));
FS->addFile(InputFile, time_t(), llvm::MemoryBuffer::getMemBuffer(""));
for (llvm::StringRef F : ExtraFiles)
Expand Down
4 changes: 2 additions & 2 deletions clang/unittests/Driver/SimpleDiagnosticConsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ struct SimpleDiagnosticConsumer : public clang::DiagnosticConsumer {
inline clang::driver::Driver diagnostic_test_driver() {
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagID(
new clang::DiagnosticIDs());
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
new llvm::vfs::InMemoryFileSystem);
auto InMemoryFileSystem =
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
auto *DiagConsumer = new SimpleDiagnosticConsumer;
clang::DiagnosticOptions DiagOpts;
clang::DiagnosticsEngine Diags(DiagID, DiagOpts, DiagConsumer);
Expand Down
Loading