[llvm] 4bb5141 - [llvm-cov] Use std::optional in SourceCoverageViewHTML.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 26 18:45:13 PST 2022
Author: Kazu Hirata
Date: 2022-11-26T18:45:08-08:00
New Revision: 4bb5141a371048a2e4befb5d76ce6aa032875032
URL: https://github.com/llvm/llvm-project/commit/4bb5141a371048a2e4befb5d76ce6aa032875032
DIFF: https://github.com/llvm/llvm-project/commit/4bb5141a371048a2e4befb5d76ce6aa032875032.diff
LOG: [llvm-cov] Use std::optional in SourceCoverageViewHTML.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:
llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index 46782c9b3c9a..03f11070df5f 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
+#include <optional>
using namespace llvm;
@@ -533,7 +534,7 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
// 1 to set the highlight for snippet 2, segment 2 to set the highlight for
// snippet 3, and so on.
- Optional<StringRef> Color;
+ std::optional<StringRef> Color;
SmallVector<std::pair<unsigned, unsigned>, 2> HighlightedRanges;
auto Highlight = [&](const std::string &Snippet, unsigned LC, unsigned RC) {
if (getOptions().Debug)
More information about the llvm-commits
mailing list