forked from OSchip/llvm-project
Use Optional instead of unique_ptr; NFC
Looks like the only reason we use a unique_ptr here is so that we can conditionally construct a LogicalErrorHandler. It's a small type, and Optional can do the same thing with 100% fewer heap allocations. llvm-svn: 338962
This commit is contained in:
parent
13ff0d8d58
commit
b65955e9eb
|
@ -2068,11 +2068,11 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
|
|||
}
|
||||
|
||||
// Install the logical handler for -Wtautological-overlap-compare
|
||||
std::unique_ptr<LogicalErrorHandler> LEH;
|
||||
llvm::Optional<LogicalErrorHandler> LEH;
|
||||
if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison,
|
||||
D->getLocStart())) {
|
||||
LEH.reset(new LogicalErrorHandler(S));
|
||||
AC.getCFGBuildOptions().Observer = LEH.get();
|
||||
LEH.emplace(S);
|
||||
AC.getCFGBuildOptions().Observer = &*LEH;
|
||||
}
|
||||
|
||||
// Emit delayed diagnostics.
|
||||
|
|
Loading…
Reference in New Issue