[StaticAnalyzer] Use std::optional in BugReporter.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 11 Dec 2022 04:54:38 +0000 (20:54 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 11 Dec 2022 04:54:38 +0000 (20:54 -0800)
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

clang/lib/StaticAnalyzer/Core/BugReporter.cpp

index 70ec6fa..d1624a8 100644 (file)
@@ -221,7 +221,7 @@ public:
   /// Find a non-invalidated report for a given equivalence class,  and returns
   /// a PathDiagnosticBuilder able to construct bug reports for different
   /// 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) {