[Frontend] Use std::optional in TextDiagnostic.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 10 Dec 2022 07:22:41 +0000 (23:22 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 10 Dec 2022 07:22:41 +0000 (23:22 -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/Frontend/TextDiagnostic.cpp

index 52129aa..809d530 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
+#include <optional>
 
 using namespace clang;
 
@@ -923,7 +924,7 @@ void TextDiagnostic::emitBuildingModuleLocation(FullSourceLoc Loc,
 }
 
 /// Find the suitable set of lines to show to include a set of ranges.
-static llvm::Optional<std::pair<unsigned, unsigned>>
+static std::optional<std::pair<unsigned, unsigned>>
 findLinesForRange(const CharSourceRange &R, FileID FID,
                   const SourceManager &SM) {
   if (!R.isValid())