@@ -220,10 +220,10 @@ static bool printSourceSymbols(const char *Executable,
220220  SmallVector<const  char  *, 4 > ArgsWithProgName;
221221  ArgsWithProgName.push_back (Executable);
222222  ArgsWithProgName.append (Args.begin (), Args.end ());
223-   DiagnosticOptions  DiagOpts;
223+   auto  DiagOpts = std::make_shared<DiagnosticOptions>() ;
224224  IntrusiveRefCntPtr<DiagnosticsEngine> Diags (
225225      CompilerInstance::createDiagnostics (*llvm::vfs::getRealFileSystem (),
226-                                           DiagOpts));
226+                                           * DiagOpts));
227227  CreateInvocationOptions CIOpts;
228228  CIOpts.Diags  = Diags;
229229  CIOpts.ProbePrecompiled  = true ; //  FIXME: historical default. Needed?
@@ -242,7 +242,7 @@ static bool printSourceSymbols(const char *Executable,
242242
243243  auto  PCHContainerOps = std::make_shared<PCHContainerOperations>();
244244  std::unique_ptr<ASTUnit> Unit (ASTUnit::LoadFromCompilerInvocationAction (
245-       std::move (CInvok), PCHContainerOps, Diags, IndexAction.get ()));
245+       std::move (CInvok), PCHContainerOps, DiagOpts,  Diags, IndexAction.get ()));
246246
247247  if  (!Unit)
248248    return  true ;
@@ -275,16 +275,16 @@ static bool printSourceSymbolsFromModule(StringRef modulePath,
275275
276276  HeaderSearchOptions HSOpts;
277277
278-   DiagnosticOptions  DiagOpts;
278+   auto  DiagOpts = std::make_shared<DiagnosticOptions>() ;
279279  IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
280280      CompilerInstance::createDiagnostics (*llvm::vfs::getRealFileSystem (),
281-                                           DiagOpts);
282-   std::unique_ptr<ASTUnit> AU =
283-       ASTUnit::LoadFromASTFile ( modulePath, *pchRdr, ASTUnit::LoadASTOnly, Diags,
284-                                 FileSystemOpts, HSOpts, /* LangOpts=*/ nullptr ,
285-                                 /* OnlyLocalDecls=*/ true , CaptureDiagsKind::None,
286-                                 /* AllowASTWithCompilerErrors=*/ true ,
287-                                 /* UserFilesAreVolatile=*/ false );
281+                                           * DiagOpts);
282+   std::unique_ptr<ASTUnit> AU =  ASTUnit::LoadFromASTFile ( 
283+       modulePath, *pchRdr, ASTUnit::LoadASTOnly, DiagOpts , Diags,
284+       FileSystemOpts, HSOpts, /* LangOpts=*/ nullptr ,
285+       /* OnlyLocalDecls=*/ true , CaptureDiagsKind::None,
286+       /* AllowASTWithCompilerErrors=*/ true ,
287+       /* UserFilesAreVolatile=*/ false );
288288  if  (!AU) {
289289    errs () << " failed to create TU for: " ' \n ' 
290290    return  true ;
0 commit comments