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
/// 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<yaml::Output> F);
/// \brief Get the prefix that should be printed in front of a diagnostic of
/// the given \p Severity
return pImpl->DiagnosticsOutputFile.get();
}
-void LLVMContext::setDiagnosticsOutputFile(yaml::Output *F) {
- pImpl->DiagnosticsOutputFile.reset(F);
+void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) {
+ pImpl->DiagnosticsOutputFile = std::move(F);
}
LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const {
return false;
}
Context.setDiagnosticsOutputFile(
- new yaml::Output(DiagnosticOutputFile->os()));
+ llvm::make_unique<yaml::Output>(DiagnosticOutputFile->os()));
}
return true;
}
errs() << EC.message() << '\n';
return 1;
}
- Context.setDiagnosticsOutputFile(new yaml::Output(YamlFile->os()));
+ Context.setDiagnosticsOutputFile(
+ llvm::make_unique<yaml::Output>(YamlFile->os()));
}
// Load the input module...