diff options
Diffstat (limited to 'clang/unittests')
22 files changed, 60 insertions, 85 deletions
diff --git a/clang/unittests/AST/ExternalASTSourceTest.cpp b/clang/unittests/AST/ExternalASTSourceTest.cpp index 8e1bde1..8b70be6 100644 --- a/clang/unittests/AST/ExternalASTSourceTest.cpp +++ b/clang/unittests/AST/ExternalASTSourceTest.cpp @@ -10,14 +10,13 @@ // //===----------------------------------------------------------------------===// -#include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/ExternalASTSource.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/CompilerInvocation.h" #include "clang/Frontend/FrontendActions.h" #include "clang/Lex/PreprocessorOptions.h" -#include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" using namespace clang; @@ -47,7 +46,7 @@ private: bool testExternalASTSource(ExternalASTSource *Source, StringRef FileContents) { CompilerInstance Compiler; - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); auto Invocation = std::make_shared<CompilerInvocation>(); Invocation->getPreprocessorOpts().addRemappedFile( diff --git a/clang/unittests/CodeGen/TestCompiler.h b/clang/unittests/CodeGen/TestCompiler.h index 931c75ef..891489c 100644 --- a/clang/unittests/CodeGen/TestCompiler.h +++ b/clang/unittests/CodeGen/TestCompiler.h @@ -20,7 +20,6 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" -#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Host.h" namespace llvm { @@ -36,7 +35,7 @@ struct TestCompiler { clang::CodeGenOptions CGO = clang::CodeGenOptions()) { compiler.getLangOpts() = LO; compiler.getCodeGenOpts() = CGO; - compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + compiler.createDiagnostics(); std::string TrStr = llvm::Triple::normalize(llvm::sys::getProcessTriple()); llvm::Triple Tr(TrStr); diff --git a/clang/unittests/Driver/DXCModeTest.cpp b/clang/unittests/Driver/DXCModeTest.cpp index 616c07c..2a079a6 100644 --- a/clang/unittests/Driver/DXCModeTest.cpp +++ b/clang/unittests/Driver/DXCModeTest.cpp @@ -219,8 +219,7 @@ TEST(DxcModeTest, DefaultEntry) { const char *Args[] = {"clang", "--driver-mode=dxc", "-Tcs_6_7", "foo.hlsl"}; IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*InMemoryFileSystem, - new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp index 0787e7d..8542a16 100644 --- a/clang/unittests/Driver/ToolChainTest.cpp +++ b/clang/unittests/Driver/ToolChainTest.cpp @@ -577,7 +577,7 @@ TEST(CompilerInvocation, SplitSwarfSingleCrash) { TEST(ToolChainTest, UEFICallingConventionTest) { clang::CompilerInstance compiler; - compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + compiler.createDiagnostics(); std::string TrStr = "x86_64-unknown-uefi"; llvm::Triple Tr(TrStr); diff --git a/clang/unittests/Frontend/ASTUnitTest.cpp b/clang/unittests/Frontend/ASTUnitTest.cpp index e6524a0..bd5d5d0 100644 --- a/clang/unittests/Frontend/ASTUnitTest.cpp +++ b/clang/unittests/Frontend/ASTUnitTest.cpp @@ -17,7 +17,6 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" using namespace llvm; @@ -42,18 +41,17 @@ protected: const char *Args[] = {"clang", "-xc++", InputFileName.c_str()}; - auto VFS = llvm::vfs::getRealFileSystem(); - Diags = CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions()); + Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; - CIOpts.VFS = VFS; CInvok = createInvocation(Args, std::move(CIOpts)); if (!CInvok) return nullptr; - FileManager *FileMgr = new FileManager(FileSystemOptions(), VFS); + FileManager *FileMgr = + new FileManager(FileSystemOptions(), vfs::getRealFileSystem()); PCHContainerOps = std::make_shared<PCHContainerOperations>(); return ASTUnit::LoadFromCompilerInvocation( @@ -136,8 +134,7 @@ TEST_F(ASTUnitTest, ModuleTextualHeader) { const char *Args[] = {"clang", "test.cpp", "-fmodule-map-file=m.modulemap", "-fmodule-name=M"}; - Diags = - CompilerInstance::createDiagnostics(*InMemoryFs, new DiagnosticOptions()); + Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; CInvok = createInvocation(Args, std::move(CIOpts)); @@ -165,8 +162,7 @@ TEST_F(ASTUnitTest, LoadFromCommandLineEarlyError) { const char *Args[] = {"clang", "-target", "foobar", InputFileName.c_str()}; - auto Diags = CompilerInstance::createDiagnostics( - *llvm::vfs::getRealFileSystem(), new DiagnosticOptions()); + auto Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); auto PCHContainerOps = std::make_shared<PCHContainerOperations>(); std::unique_ptr<clang::ASTUnit> ErrUnit; @@ -193,8 +189,7 @@ TEST_F(ASTUnitTest, LoadFromCommandLineWorkingDirectory) { const char *Args[] = {"clang", "-working-directory", WorkingDir.c_str(), InputFileName.c_str()}; - auto Diags = CompilerInstance::createDiagnostics( - *llvm::vfs::getRealFileSystem(), new DiagnosticOptions()); + auto Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); auto PCHContainerOps = std::make_shared<PCHContainerOperations>(); std::unique_ptr<clang::ASTUnit> ErrUnit; diff --git a/clang/unittests/Frontend/CodeGenActionTest.cpp b/clang/unittests/Frontend/CodeGenActionTest.cpp index d855302..a6520910 100644 --- a/clang/unittests/Frontend/CodeGenActionTest.cpp +++ b/clang/unittests/Frontend/CodeGenActionTest.cpp @@ -16,7 +16,6 @@ #include "clang/Frontend/CompilerInstance.h" #include "clang/Lex/PreprocessorOptions.h" #include "llvm/Support/FormatVariadic.h" -#include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" using namespace llvm; @@ -53,7 +52,7 @@ TEST(CodeGenTest, TestNullCodeGen) { Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); EXPECT_TRUE(Compiler.hasDiagnostics()); std::unique_ptr<FrontendAction> Act(new NullCodeGenAction); @@ -71,7 +70,7 @@ TEST(CodeGenTest, CodeGenFromIRMemBuffer) { Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); EXPECT_TRUE(Compiler.hasDiagnostics()); EmitLLVMOnlyAction Action; @@ -102,7 +101,7 @@ TEST(CodeGenTest, DebugInfoCWDCodeGen) { SmallString<256> IRBuffer; Compiler.setOutputStream(std::make_unique<raw_svector_ostream>(IRBuffer)); Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*VFS); + Compiler.createDiagnostics(); Compiler.createFileManager(std::move(VFS)); EmitLLVMAction Action; diff --git a/clang/unittests/Frontend/CompilerInstanceTest.cpp b/clang/unittests/Frontend/CompilerInstanceTest.cpp index 07329eb2..5cf548e9 100644 --- a/clang/unittests/Frontend/CompilerInstanceTest.cpp +++ b/clang/unittests/Frontend/CompilerInstanceTest.cpp @@ -13,7 +13,6 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" using namespace llvm; @@ -54,8 +53,7 @@ TEST(CompilerInstance, DefaultVFSOverlayFromInvocation) { const char *Args[] = {"clang", VFSArg.c_str(), "-xc++", "-"}; IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*llvm::vfs::getRealFileSystem(), - new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; @@ -89,9 +87,8 @@ TEST(CompilerInstance, AllowDiagnosticLogWithUnownedDiagnosticConsumer) { auto DiagPrinter = std::make_unique<TextDiagnosticPrinter>( DiagnosticsOS, new DiagnosticOptions()); CompilerInstance Instance; - IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - Instance.createDiagnostics(*llvm::vfs::getRealFileSystem(), DiagOpts, - DiagPrinter.get(), /*ShouldOwnClient=*/false); + IntrusiveRefCntPtr<DiagnosticsEngine> Diags = Instance.createDiagnostics( + DiagOpts, DiagPrinter.get(), /*ShouldOwnClient=*/false); Diags->Report(diag::err_expected) << "no crash"; ASSERT_EQ(DiagnosticOutput, "error: expected no crash\n"); diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp index 4ff6824..45478de 100644 --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -12,7 +12,6 @@ #include "clang/Frontend/TextDiagnosticBuffer.h" #include "clang/Lex/PreprocessorOptions.h" #include "clang/Serialization/ModuleFileExtension.h" -#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Host.h" #include "gmock/gmock.h" @@ -39,9 +38,9 @@ public: } CommandLineTest() - : Diags(CompilerInstance::createDiagnostics( - *llvm::vfs::getRealFileSystem(), new DiagnosticOptions(), - new TextDiagnosticBuffer())) {} + : Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions(), + new TextDiagnosticBuffer())) { + } }; template <typename M> diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp index 75e1667..6ce9ba6 100644 --- a/clang/unittests/Frontend/FrontendActionTest.cpp +++ b/clang/unittests/Frontend/FrontendActionTest.cpp @@ -20,7 +20,6 @@ #include "clang/Serialization/InMemoryModuleCache.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Triple.h" #include "gtest/gtest.h" @@ -91,7 +90,7 @@ TEST(ASTFrontendAction, Sanity) { invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; compiler.setInvocation(std::move(invocation)); - compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + compiler.createDiagnostics(); TestASTFrontendAction test_action; ASSERT_TRUE(compiler.ExecuteAction(test_action)); @@ -111,7 +110,7 @@ TEST(ASTFrontendAction, IncrementalParsing) { invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; compiler.setInvocation(std::move(invocation)); - compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + compiler.createDiagnostics(); TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true); ASSERT_TRUE(compiler.ExecuteAction(test_action)); @@ -138,7 +137,7 @@ TEST(ASTFrontendAction, LateTemplateIncrementalParsing) { invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; compiler.setInvocation(std::move(invocation)); - compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + compiler.createDiagnostics(); TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true, /*actOnEndOfTranslationUnit=*/true); @@ -184,7 +183,7 @@ TEST(PreprocessorFrontendAction, EndSourceFile) { Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); TestPPCallbacks *Callbacks = new TestPPCallbacks; TestPPCallbacksFrontendAction TestAction(Callbacks); @@ -246,8 +245,7 @@ TEST(ASTFrontendAction, ExternalSemaSource) { CompilerInstance Compiler; Compiler.setInvocation(std::move(Invocation)); auto *TDC = new TypoDiagnosticConsumer; - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem(), TDC, - /*ShouldOwnClient=*/true); + Compiler.createDiagnostics(TDC, /*ShouldOwnClient=*/true); Compiler.setExternalSemaSource(new TypoExternalSemaSource(Compiler)); SyntaxOnlyAction TestAction; @@ -279,7 +277,7 @@ TEST(GeneratePCHFrontendAction, CacheGeneratedPCH) { Invocation->getTargetOpts().Triple = "x86_64-apple-darwin19.0.0"; CompilerInstance Compiler; Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); GeneratePCHAction TestAction; ASSERT_TRUE(Compiler.ExecuteAction(TestAction)); diff --git a/clang/unittests/Frontend/OutputStreamTest.cpp b/clang/unittests/Frontend/OutputStreamTest.cpp index fa5d726..2618558 100644 --- a/clang/unittests/Frontend/OutputStreamTest.cpp +++ b/clang/unittests/Frontend/OutputStreamTest.cpp @@ -13,7 +13,6 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/FrontendTool/Utils.h" #include "clang/Lex/PreprocessorOptions.h" -#include "llvm/Support/VirtualFileSystem.h" #include "gtest/gtest.h" using namespace llvm; @@ -38,7 +37,7 @@ TEST(FrontendOutputTests, TestOutputStream) { Compiler.setOutputStream(std::move(IRStream)); Compiler.setInvocation(std::move(Invocation)); - Compiler.createDiagnostics(*llvm::vfs::getRealFileSystem()); + Compiler.createDiagnostics(); bool Success = ExecuteCompilerInvocation(&Compiler); EXPECT_TRUE(Success); @@ -63,7 +62,6 @@ TEST(FrontendOutputTests, TestVerboseOutputStreamShared) { Compiler.setInvocation(std::move(Invocation)); IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); Compiler.createDiagnostics( - *llvm::vfs::getRealFileSystem(), new TextDiagnosticPrinter(llvm::nulls(), &*DiagOpts), true); Compiler.setVerboseOutputStream(VerboseStream); @@ -93,7 +91,6 @@ TEST(FrontendOutputTests, TestVerboseOutputStreamOwned) { Compiler.setInvocation(std::move(Invocation)); IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); Compiler.createDiagnostics( - *llvm::vfs::getRealFileSystem(), new TextDiagnosticPrinter(llvm::nulls(), &*DiagOpts), true); Compiler.setVerboseOutputStream(std::move(VerboseStream)); diff --git a/clang/unittests/Frontend/PCHPreambleTest.cpp b/clang/unittests/Frontend/PCHPreambleTest.cpp index 58ec2e2..2ce24c9 100644 --- a/clang/unittests/Frontend/PCHPreambleTest.cpp +++ b/clang/unittests/Frontend/PCHPreambleTest.cpp @@ -94,9 +94,8 @@ public: PreprocessorOptions &PPOpts = CI->getPreprocessorOpts(); PPOpts.RemappedFilesKeepOriginalName = true; - IntrusiveRefCntPtr<DiagnosticsEngine> Diags( - CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions, - new DiagnosticConsumer)); + IntrusiveRefCntPtr<DiagnosticsEngine> + Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions, new DiagnosticConsumer)); FileManager *FileMgr = new FileManager(FSOpts, VFS); diff --git a/clang/unittests/Frontend/ReparseWorkingDirTest.cpp b/clang/unittests/Frontend/ReparseWorkingDirTest.cpp index b0f2d51..ca7ce23 100644 --- a/clang/unittests/Frontend/ReparseWorkingDirTest.cpp +++ b/clang/unittests/Frontend/ReparseWorkingDirTest.cpp @@ -58,7 +58,7 @@ public: CI->getTargetOpts().Triple = "i386-unknown-linux-gnu"; IntrusiveRefCntPtr<DiagnosticsEngine> Diags( - CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions, + CompilerInstance::createDiagnostics(new DiagnosticOptions, new DiagnosticConsumer)); FileManager *FileMgr = new FileManager(CI->getFileSystemOpts(), VFS); diff --git a/clang/unittests/Frontend/UtilsTest.cpp b/clang/unittests/Frontend/UtilsTest.cpp index 304fbe2..ae014d3 100644 --- a/clang/unittests/Frontend/UtilsTest.cpp +++ b/clang/unittests/Frontend/UtilsTest.cpp @@ -28,9 +28,9 @@ TEST(BuildCompilerInvocationTest, RecoverMultipleJobs) { clang::IgnoringDiagConsumer D; CreateInvocationOptions Opts; Opts.RecoverOnError = true; + Opts.Diags = clang::CompilerInstance::createDiagnostics(new DiagnosticOptions, + &D, false); Opts.VFS = new llvm::vfs::InMemoryFileSystem(); - Opts.Diags = clang::CompilerInstance::createDiagnostics( - *Opts.VFS, new DiagnosticOptions, &D, false); std::unique_ptr<CompilerInvocation> CI = createInvocation(Args, Opts); ASSERT_TRUE(CI); EXPECT_THAT(CI->TargetOpts->Triple, testing::StartsWith("i386-")); @@ -46,7 +46,7 @@ TEST(BuildCompilerInvocationTest, ProbePrecompiled) { clang::IgnoringDiagConsumer D; llvm::IntrusiveRefCntPtr<DiagnosticsEngine> CommandLineDiagsEngine = - clang::CompilerInstance::createDiagnostics(*FS, new DiagnosticOptions, &D, + clang::CompilerInstance::createDiagnostics(new DiagnosticOptions, &D, false); // Default: ProbePrecompiled=false CreateInvocationOptions CIOpts; diff --git a/clang/unittests/Sema/SemaNoloadLookupTest.cpp b/clang/unittests/Sema/SemaNoloadLookupTest.cpp index a8e1bb0..cf89c73 100644 --- a/clang/unittests/Sema/SemaNoloadLookupTest.cpp +++ b/clang/unittests/Sema/SemaNoloadLookupTest.cpp @@ -57,12 +57,11 @@ public: std::string FileName = llvm::Twine(ModuleName + ".cppm").str(); addFile(FileName, Contents); - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::getRealFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, - new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); std::string CacheBMIPath = llvm::Twine(TestDir + "/" + ModuleName + ".pcm").str(); diff --git a/clang/unittests/Serialization/ForceCheckFileInputTest.cpp b/clang/unittests/Serialization/ForceCheckFileInputTest.cpp index 6a839d1..ad8892b 100644 --- a/clang/unittests/Serialization/ForceCheckFileInputTest.cpp +++ b/clang/unittests/Serialization/ForceCheckFileInputTest.cpp @@ -63,13 +63,11 @@ export int aa = 43; std::string BMIPath = llvm::Twine(TestDir + "/a.pcm").str(); { - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); - IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, - new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); const char *Args[] = {"clang++", "-std=c++20", "--precompile", "-working-directory", @@ -105,12 +103,11 @@ export int aa = 43; } { - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, - new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); std::string BMIPath = llvm::Twine(TestDir + "/a.pcm").str(); const char *Args[] = { diff --git a/clang/unittests/Serialization/ModuleCacheTest.cpp b/clang/unittests/Serialization/ModuleCacheTest.cpp index 6ceee1c..a7ca985 100644 --- a/clang/unittests/Serialization/ModuleCacheTest.cpp +++ b/clang/unittests/Serialization/ModuleCacheTest.cpp @@ -106,11 +106,11 @@ TEST_F(ModuleCacheTest, CachedModuleNewPath) { SmallString<256> MCPArg("-fmodules-cache-path="); MCPArg.append(ModuleCachePath); - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); // First run should pass with no errors const char *Args[] = {"clang", "-fmodules", "-Fframeworks", @@ -156,11 +156,11 @@ TEST_F(ModuleCacheTest, CachedModuleNewPathAllowErrors) { SmallString<256> MCPArg("-fmodules-cache-path="); MCPArg.append(ModuleCachePath); - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); // First run should pass with no errors const char *Args[] = {"clang", "-fmodules", "-Fframeworks", diff --git a/clang/unittests/Serialization/NoCommentsTest.cpp b/clang/unittests/Serialization/NoCommentsTest.cpp index a1fb234..a0a564a 100644 --- a/clang/unittests/Serialization/NoCommentsTest.cpp +++ b/clang/unittests/Serialization/NoCommentsTest.cpp @@ -83,11 +83,11 @@ export module Comments; void foo() {} )cpp"); - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); std::string CacheBMIPath = llvm::Twine(TestDir + "/Comments.pcm").str(); const char *Args[] = {"clang++", "-std=c++20", diff --git a/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp b/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp index cf317ed..d26e1cb 100644 --- a/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp +++ b/clang/unittests/Serialization/PreambleInNamedModulesTest.cpp @@ -75,10 +75,10 @@ export using ::E; )cpp", MainFilePath); + IntrusiveRefCntPtr<DiagnosticsEngine> Diags = + CompilerInstance::createDiagnostics(new DiagnosticOptions()); IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = llvm::vfs::createPhysicalFileSystem(); - IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions()); CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; diff --git a/clang/unittests/Serialization/VarDeclConstantInitTest.cpp b/clang/unittests/Serialization/VarDeclConstantInitTest.cpp index 14c0c30..5cbbfb9 100644 --- a/clang/unittests/Serialization/VarDeclConstantInitTest.cpp +++ b/clang/unittests/Serialization/VarDeclConstantInitTest.cpp @@ -90,11 +90,11 @@ export namespace Fibonacci } )cpp"); - CreateInvocationOptions CIOpts; - CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); IntrusiveRefCntPtr<DiagnosticsEngine> Diags = - CompilerInstance::createDiagnostics(*CIOpts.VFS, new DiagnosticOptions()); + CompilerInstance::createDiagnostics(new DiagnosticOptions()); + CreateInvocationOptions CIOpts; CIOpts.Diags = Diags; + CIOpts.VFS = llvm::vfs::createPhysicalFileSystem(); const char *Args[] = {"clang++", "-std=c++20", "--precompile", "-working-directory", diff --git a/clang/unittests/Support/TimeProfilerTest.cpp b/clang/unittests/Support/TimeProfilerTest.cpp index 995ebf6..339b470 100644 --- a/clang/unittests/Support/TimeProfilerTest.cpp +++ b/clang/unittests/Support/TimeProfilerTest.cpp @@ -45,6 +45,8 @@ std::string teardownProfiler() { // We only parse AST here. This is enough for constexpr evaluation. bool compileFromString(StringRef Code, StringRef Standard, StringRef File, llvm::StringMap<std::string> Headers = {}) { + CompilerInstance Compiler; + Compiler.createDiagnostics(); llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> FS( new llvm::vfs::InMemoryFileSystem()); @@ -55,8 +57,6 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef File, } llvm::IntrusiveRefCntPtr<FileManager> Files( new FileManager(FileSystemOptions(), FS)); - CompilerInstance Compiler; - Compiler.createDiagnostics(Files->getVirtualFileSystem()); Compiler.setFileManager(Files.get()); auto Invocation = std::make_shared<CompilerInvocation>(); diff --git a/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp b/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp index e1c4770..ec0e143 100644 --- a/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp +++ b/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp @@ -60,8 +60,7 @@ public: Compiler.setInvocation(std::move(Invocation)); Compiler.setFileManager(FileMgr); - Compiler.createDiagnostics(FileMgr->getVirtualFileSystem(), DiagConsumer, - /*ShouldOwnClient=*/false); + Compiler.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false); if (!Compiler.hasDiagnostics()) return false; diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index 0b65577..f41a44fa 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -384,8 +384,7 @@ struct CommandLineExtractorTest : public ::testing::Test { public: CommandLineExtractorTest() : InMemoryFS(new llvm::vfs::InMemoryFileSystem), - Diags(CompilerInstance::createDiagnostics(*InMemoryFS, - new DiagnosticOptions)), + Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions)), Driver("clang", llvm::sys::getDefaultTargetTriple(), *Diags, "clang LLVM compiler", overlayRealFS(InMemoryFS)) {} |