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:
George Burgess IV 2018-08-05 01:37:07 +00:00
parent 13ff0d8d58
commit b65955e9eb
1 changed files with 3 additions and 3 deletions

View File

@ -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.