@@ -43,9 +43,9 @@ std::string getExecutablePath(const char *argv0) {
4343
4444//  This lets us create the DiagnosticsEngine with a properly-filled-out
4545//  DiagnosticOptions instance
46- static  clang::DiagnosticOptions * 
46+ static  std::unique_ptr< clang::DiagnosticOptions> 
4747createAndPopulateDiagOpts (llvm::ArrayRef<const  char  *> argv) {
48-   auto  * diagOpts = new   clang::DiagnosticOptions;
48+   auto  diagOpts = std::make_unique< clang::DiagnosticOptions>() ;
4949
5050  //  Ignore missingArgCount and the return value of ParseDiagnosticArgs.
5151  //  Any errors that would be diagnosed here will also be diagnosed later,
@@ -114,17 +114,17 @@ int main(int argc, const char **argv) {
114114  //  Not in the frontend mode - continue in the compiler driver mode.
115115
116116  //  Create DiagnosticsEngine for the compiler driver
117-   llvm::IntrusiveRefCntPtr <clang::DiagnosticOptions> diagOpts =
117+   std::unique_ptr <clang::DiagnosticOptions> diagOpts =
118118      createAndPopulateDiagOpts (args);
119119  llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagID (
120120      new  clang::DiagnosticIDs ());
121121  Fortran::frontend::TextDiagnosticPrinter *diagClient =
122-       new  Fortran::frontend::TextDiagnosticPrinter (llvm::errs (), & *diagOpts);
122+       new  Fortran::frontend::TextDiagnosticPrinter (llvm::errs (), *diagOpts);
123123
124124  diagClient->setPrefix (
125125      std::string (llvm::sys::path::stem (getExecutablePath (args[0 ]))));
126126
127-   clang::DiagnosticsEngine diags (diagID, & *diagOpts, diagClient);
127+   clang::DiagnosticsEngine diags (diagID, *diagOpts, diagClient);
128128
129129  //  Prepare the driver
130130  clang::driver::Driver theDriver (driverPath,
0 commit comments