[clang] ec94a5b - [StaticAnalyzer] Use std::optional in BugReporter.cpp (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 10 20:54:47 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T20:54:38-08:00
New Revision: ec94a5b71685d7d1d384fae5f6aa51b0c3d41037
URL: https://github.com/llvm/llvm-project/commit/ec94a5b71685d7d1d384fae5f6aa51b0c3d41037
DIFF: https://github.com/llvm/llvm-project/commit/ec94a5b71685d7d1d384fae5f6aa51b0c3d41037.diff
LOG: [StaticAnalyzer] Use std::optional in BugReporter.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Added:
Modified:
clang/lib/StaticAnalyzer/Core/BugReporter.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index 70ec6face951b..d1624a82663e3 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -221,7 +221,7 @@ class PathDiagnosticBuilder : public BugReporterContext {
/// Find a non-invalidated report for a given equivalence class, and returns
/// a PathDiagnosticBuilder able to construct bug reports for
diff erent
/// consumers. Returns std::nullopt if no valid report is found.
- static Optional<PathDiagnosticBuilder>
+ static std::optional<PathDiagnosticBuilder>
findValidReport(ArrayRef<PathSensitiveBugReport *> &bugReports,
PathSensitiveBugReporter &Reporter);
@@ -2821,7 +2821,7 @@ generateVisitorsDiagnostics(PathSensitiveBugReport *R,
return Notes;
}
-Optional<PathDiagnosticBuilder> PathDiagnosticBuilder::findValidReport(
+std::optional<PathDiagnosticBuilder> PathDiagnosticBuilder::findValidReport(
ArrayRef<PathSensitiveBugReport *> &bugReports,
PathSensitiveBugReporter &Reporter) {
@@ -2880,7 +2880,7 @@ PathSensitiveBugReporter::generatePathDiagnostics(
auto Out = std::make_unique<DiagnosticForConsumerMapTy>();
- Optional<PathDiagnosticBuilder> PDB =
+ std::optional<PathDiagnosticBuilder> PDB =
PathDiagnosticBuilder::findValidReport(bugReports, *this);
if (PDB) {
More information about the cfe-commits
mailing list