aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:11 +0000
commite3b557809604d036af6e00c60f012c2025b59a5e (patch)
tree8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parent08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff)
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 8c1eadbe8271..6113f78aeb4e 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -14,8 +14,6 @@
#include "llvm/ProfileData/Coverage/CoverageMapping.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/None.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -33,6 +31,7 @@
#include <iterator>
#include <map>
#include <memory>
+#include <optional>
#include <string>
#include <system_error>
#include <utility>
@@ -455,10 +454,10 @@ class SegmentBuilder {
/// Emit segments for active regions which end before \p Loc.
///
- /// \p Loc: The start location of the next region. If None, all active
+ /// \p Loc: The start location of the next region. If std::nullopt, all active
/// regions are completed.
/// \p FirstCompletedRegion: Index of the first completed region.
- void completeRegionsUntil(Optional<LineColPair> Loc,
+ void completeRegionsUntil(std::optional<LineColPair> Loc,
unsigned FirstCompletedRegion) {
// Sort the completed regions by end location. This makes it simple to
// emit closing segments in sorted order.
@@ -557,7 +556,7 @@ class SegmentBuilder {
// Complete any remaining active regions.
if (!ActiveRegions.empty())
- completeRegionsUntil(None, 0);
+ completeRegionsUntil(std::nullopt, 0);
}
/// Sort a nested sequence of regions from a single file.
@@ -676,25 +675,27 @@ static SmallBitVector gatherFileIDs(StringRef SourceFile,
}
/// Return the ID of the file where the definition of the function is located.
-static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
+static std::optional<unsigned>
+findMainViewFileID(const FunctionRecord &Function) {
SmallBitVector IsNotExpandedFile(Function.Filenames.size(), true);
for (const auto &CR : Function.CountedRegions)
if (CR.Kind == CounterMappingRegion::ExpansionRegion)
IsNotExpandedFile[CR.ExpandedFileID] = false;
int I = IsNotExpandedFile.find_first();
if (I == -1)
- return None;
+ return std::nullopt;
return I;
}
/// Check if SourceFile is the file that contains the definition of
-/// the Function. Return the ID of the file in that case or None otherwise.
-static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
- const FunctionRecord &Function) {
- Optional<unsigned> I = findMainViewFileID(Function);
+/// the Function. Return the ID of the file in that case or std::nullopt
+/// otherwise.
+static std::optional<unsigned>
+findMainViewFileID(StringRef SourceFile, const FunctionRecord &Function) {
+ std::optional<unsigned> I = findMainViewFileID(Function);
if (I && SourceFile == Function.Filenames[*I])
return I;
- return None;
+ return std::nullopt;
}
static bool isExpansion(const CountedRegion &R, unsigned FileID) {