[libc-commits] [libc] 23a6932 - [libc] Use std::nullopt instead of None (NFC)
Kazu Hirata via libc-commits
libc-commits at lists.llvm.org
Fri Dec 9 19:47:22 PST 2022
Author: Kazu Hirata
Date: 2022-12-09T19:47:17-08:00
New Revision: 23a6932c4989673df204b4692ca805d1556ba0e1
URL: https://github.com/llvm/llvm-project/commit/23a6932c4989673df204b4692ca805d1556ba0e1
DIFF: https://github.com/llvm/llvm-project/commit/23a6932c4989673df204b4692ca805d1556ba0e1.diff
LOG: [libc] Use std::nullopt instead of None (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:
libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
Removed:
################################################################################
diff --git a/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp b/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
index c8ceecc0d609..ec8417383200 100644
--- a/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
+++ b/libc/benchmarks/automemcpy/lib/RandomFunctionGenerator.cpp
@@ -12,6 +12,7 @@
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/raw_ostream.h>
+#include <optional>
#include <set>
namespace llvm {
@@ -159,7 +160,7 @@ RandomFunctionGenerator::RandomFunctionGenerator()
// Returns std::nullopt if Begin==End.
static Optional<SizeSpan> AsSizeSpan(size_t Begin, size_t End) {
if (Begin == End)
- return None;
+ return std::nullopt;
SizeSpan SS;
SS.Begin = Begin;
SS.End = End;
@@ -175,7 +176,7 @@ static Optional<Region> As(size_t Begin, size_t End) {
Output.Span = *Span;
return Output;
}
- return None;
+ return std::nullopt;
}
// Returns a Loop struct or None if span is empty.
@@ -186,7 +187,7 @@ static Optional<Loop> AsLoop(size_t Begin, size_t End, size_t BlockSize) {
Output.BlockSize = BlockSize;
return Output;
}
- return None;
+ return std::nullopt;
}
// Returns an AlignedLoop struct or None if span is empty.
@@ -200,7 +201,7 @@ static Optional<AlignedLoop> AsAlignedLoop(size_t Begin, size_t End,
Output.AlignTo = AlignTo;
return Output;
}
- return None;
+ return std::nullopt;
}
Optional<FunctionDescriptor> RandomFunctionGenerator::next() {
More information about the libc-commits
mailing list