mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 12:36:07 +00:00
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 llvm-svn: 287449
This commit is contained in:
parent
0a94bffe12
commit
6f40836823
@ -195,7 +195,8 @@ namespace clang {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os()));
|
Ctx.setDiagnosticsOutputFile(
|
||||||
|
llvm::make_unique<yaml::Output>(OptRecordFile->os()));
|
||||||
|
|
||||||
if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
|
if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
|
||||||
Ctx.setDiagnosticHotnessRequested(true);
|
Ctx.setDiagnosticHotnessRequested(true);
|
||||||
|
@ -194,7 +194,7 @@ public:
|
|||||||
/// By default or if invoked with null, diagnostics are not saved in a file
|
/// 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
|
/// but only emitted via the diagnostic handler. Even if an output file is
|
||||||
/// set, the handler is invoked for each diagnostic message.
|
/// 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
|
/// \brief Get the prefix that should be printed in front of a diagnostic of
|
||||||
/// the given \p Severity
|
/// the given \p Severity
|
||||||
|
@ -212,8 +212,8 @@ yaml::Output *LLVMContext::getDiagnosticsOutputFile() {
|
|||||||
return pImpl->DiagnosticsOutputFile.get();
|
return pImpl->DiagnosticsOutputFile.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMContext::setDiagnosticsOutputFile(yaml::Output *F) {
|
void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) {
|
||||||
pImpl->DiagnosticsOutputFile.reset(F);
|
pImpl->DiagnosticsOutputFile = std::move(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const {
|
LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const {
|
||||||
|
@ -511,7 +511,7 @@ bool LTOCodeGenerator::setupOptimizationRemarks() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Context.setDiagnosticsOutputFile(
|
Context.setDiagnosticsOutputFile(
|
||||||
new yaml::Output(DiagnosticOutputFile->os()));
|
llvm::make_unique<yaml::Output>(DiagnosticOutputFile->os()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,8 @@ int main(int argc, char **argv) {
|
|||||||
errs() << EC.message() << '\n';
|
errs() << EC.message() << '\n';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Context.setDiagnosticsOutputFile(new yaml::Output(YamlFile->os()));
|
Context.setDiagnosticsOutputFile(
|
||||||
|
llvm::make_unique<yaml::Output>(YamlFile->os()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the input module...
|
// Load the input module...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user