llvm.org GIT mirror llvm / 1bb4b12
Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC) Summary: This makes it explicit that ownership is taken. Also replace all `new` with make_unique<> at call sites. Reviewers: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26884 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287449 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
4 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
193193 /// By default or if invoked with null, diagnostics are not saved in a file
194194 /// but only emitted via the diagnostic handler. Even if an output file is
195195 /// set, the handler is invoked for each diagnostic message.
196 void setDiagnosticsOutputFile(yaml::Output *F);
196 void setDiagnosticsOutputFile(std::unique_ptr F);
197197
198198 /// \brief Get the prefix that should be printed in front of a diagnostic of
199199 /// the given \p Severity
211211 return pImpl->DiagnosticsOutputFile.get();
212212 }
213213
214 void LLVMContext::setDiagnosticsOutputFile(yaml::Output *F) {
215 pImpl->DiagnosticsOutputFile.reset(F);
214 void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr F) {
215 pImpl->DiagnosticsOutputFile = std::move(F);
216216 }
217217
218218 LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const {
510510 return false;
511511 }
512512 Context.setDiagnosticsOutputFile(
513 new yaml::Output(DiagnosticOutputFile->os()));
513 llvm::make_unique(DiagnosticOutputFile->os()));
514514 }
515515 return true;
516516 }
423423 errs() << EC.message() << '\n';
424424 return 1;
425425 }
426 Context.setDiagnosticsOutputFile(new yaml::Output(YamlFile->os()));
426 Context.setDiagnosticsOutputFile(
427 llvm::make_unique(YamlFile->os()));
427428 }
428429
429430 // Load the input module...