[clang] ebd3eef - [Frontend] Use std::optional in TextDiagnostic.cpp (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 9 23:22:46 PST 2022
Author: Kazu Hirata
Date: 2022-12-09T23:22:41-08:00
New Revision: ebd3eef0b2b0255e4cf1cd825019ff66d3cd1426
URL: https://github.com/llvm/llvm-project/commit/ebd3eef0b2b0255e4cf1cd825019ff66d3cd1426
DIFF: https://github.com/llvm/llvm-project/commit/ebd3eef0b2b0255e4cf1cd825019ff66d3cd1426.diff
LOG: [Frontend] Use std::optional in TextDiagnostic.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/Frontend/TextDiagnostic.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 52129aa4ff2b..809d5309d1af 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -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())
More information about the cfe-commits
mailing list