@@ -30,7 +30,8 @@ class ASTUnitTest : public ::testing::Test {
3030 int FD;
3131 llvm::SmallString<256 > InputFileName;
3232 std::unique_ptr<ToolOutputFile> input_file;
33- DiagnosticOptions DiagOpts;
33+ std::shared_ptr<DiagnosticOptions> DiagOpts =
34+ std::make_shared<DiagnosticOptions>();
3435 IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
3536 std::shared_ptr<CompilerInvocation> CInvok;
3637 std::shared_ptr<PCHContainerOperations> PCHContainerOps;
@@ -44,7 +45,7 @@ class ASTUnitTest : public ::testing::Test {
4445 const char *Args[] = {" clang" , " -xc++" , InputFileName.c_str ()};
4546
4647 auto VFS = llvm::vfs::getRealFileSystem ();
47- Diags = CompilerInstance::createDiagnostics (*VFS, DiagOpts);
48+ Diags = CompilerInstance::createDiagnostics (*VFS, * DiagOpts);
4849
4950 CreateInvocationOptions CIOpts;
5051 CIOpts.Diags = Diags;
@@ -138,7 +139,7 @@ TEST_F(ASTUnitTest, ModuleTextualHeader) {
138139 const char *Args[] = {" clang" , " test.cpp" , " -fmodule-map-file=m.modulemap" ,
139140 " -fmodule-name=M" };
140141 Diags =
141- CompilerInstance::createDiagnostics (*InMemoryFs, DiagOpts);
142+ CompilerInstance::createDiagnostics (*InMemoryFs, * DiagOpts);
142143 CreateInvocationOptions CIOpts;
143144 CIOpts.Diags = Diags;
144145 CInvok = createInvocation (Args, std::move (CIOpts));
@@ -167,12 +168,12 @@ TEST_F(ASTUnitTest, LoadFromCommandLineEarlyError) {
167168 const char *Args[] = {" clang" , " -target" , " foobar" , InputFileName.c_str ()};
168169
169170 auto Diags = CompilerInstance::createDiagnostics (
170- *llvm::vfs::getRealFileSystem (), DiagOpts);
171+ *llvm::vfs::getRealFileSystem (), * DiagOpts);
171172 auto PCHContainerOps = std::make_shared<PCHContainerOperations>();
172173 std::unique_ptr<clang::ASTUnit> ErrUnit;
173174
174175 std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCommandLine (
175- &Args[0 ], &Args[4 ], PCHContainerOps, Diags, " " , false , " " , false ,
176+ &Args[0 ], &Args[4 ], PCHContainerOps, DiagOpts, Diags, " " , false , " " , false ,
176177 CaptureDiagsKind::All, {}, true , 0 , TU_Complete, false , false , false ,
177178 SkipFunctionBodiesScope::None, false , true , false , false , std::nullopt ,
178179 &ErrUnit, nullptr );
@@ -195,12 +196,12 @@ TEST_F(ASTUnitTest, LoadFromCommandLineWorkingDirectory) {
195196 InputFileName.c_str ()};
196197
197198 auto Diags = CompilerInstance::createDiagnostics (
198- *llvm::vfs::getRealFileSystem (), DiagOpts);
199+ *llvm::vfs::getRealFileSystem (), * DiagOpts);
199200 auto PCHContainerOps = std::make_shared<PCHContainerOperations>();
200201 std::unique_ptr<clang::ASTUnit> ErrUnit;
201202
202203 std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCommandLine (
203- &Args[0 ], &Args[4 ], PCHContainerOps, Diags, " " , false , " " , false ,
204+ &Args[0 ], &Args[4 ], PCHContainerOps, DiagOpts, Diags, " " , false , " " , false ,
204205 CaptureDiagsKind::All, {}, true , 0 , TU_Complete, false , false , false ,
205206 SkipFunctionBodiesScope::None, false , true , false , false , std::nullopt ,
206207 &ErrUnit, nullptr );
0 commit comments