Index: clang/lib/CodeGen/CodeGenAction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenAction.cpp +++ clang/lib/CodeGen/CodeGenAction.cpp @@ -195,7 +195,8 @@ return; } - Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os())); + Ctx.setDiagnosticsOutputFile( + llvm::make_unique(OptRecordFile->os())); if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone) Ctx.setDiagnosticHotnessRequested(true); Index: llvm/include/llvm/IR/LLVMContext.h =================================================================== --- llvm/include/llvm/IR/LLVMContext.h +++ llvm/include/llvm/IR/LLVMContext.h @@ -194,7 +194,7 @@ /// By default or if invoked with null, diagnostics are not saved in a file /// but only emitted via the diagnostic handler. Even if an output file is /// set, the handler is invoked for each diagnostic message. - void setDiagnosticsOutputFile(yaml::Output *F); + void setDiagnosticsOutputFile(std::unique_ptr F); /// \brief Get the prefix that should be printed in front of a diagnostic of /// the given \p Severity Index: llvm/lib/IR/LLVMContext.cpp =================================================================== --- llvm/lib/IR/LLVMContext.cpp +++ llvm/lib/IR/LLVMContext.cpp @@ -212,8 +212,8 @@ return pImpl->DiagnosticsOutputFile.get(); } -void LLVMContext::setDiagnosticsOutputFile(yaml::Output *F) { - pImpl->DiagnosticsOutputFile.reset(F); +void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr F) { + pImpl->DiagnosticsOutputFile = std::move(F); } LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const { Index: llvm/lib/LTO/LTOCodeGenerator.cpp =================================================================== --- llvm/lib/LTO/LTOCodeGenerator.cpp +++ llvm/lib/LTO/LTOCodeGenerator.cpp @@ -511,7 +511,7 @@ return false; } Context.setDiagnosticsOutputFile( - new yaml::Output(DiagnosticOutputFile->os())); + llvm::make_unique(DiagnosticOutputFile->os())); } return true; } Index: llvm/tools/opt/opt.cpp =================================================================== --- llvm/tools/opt/opt.cpp +++ llvm/tools/opt/opt.cpp @@ -424,7 +424,8 @@ errs() << EC.message() << '\n'; return 1; } - Context.setDiagnosticsOutputFile(new yaml::Output(YamlFile->os())); + Context.setDiagnosticsOutputFile( + llvm::make_unique(YamlFile->os())); } // Load the input module...