[libc-commits] [libc] e1cdda5 - [libc] Use std::optional instead of llvm::Optional (NFC)

Kazu Hirata via libc-commits libc-commits at lists.llvm.org
Sat Jan 14 20:22:59 PST 2023


Author: Kazu Hirata
Date: 2023-01-14T20:22:48-08:00
New Revision: e1cdda57fabddb809b17f30f5dcd3e59518cafa7

URL: https://github.com/llvm/llvm-project/commit/e1cdda57fabddb809b17f30f5dcd3e59518cafa7
DIFF: https://github.com/llvm/llvm-project/commit/e1cdda57fabddb809b17f30f5dcd3e59518cafa7.diff

LOG: [libc] Use std::optional instead of llvm::Optional (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/LibcBenchmark.h
    libc/benchmarks/LibcBenchmarkTest.cpp
    libc/benchmarks/automemcpy/lib/CodeGen.cpp
    libc/utils/LibcTableGenUtil/APIIndexer.h

Removed: 
    


################################################################################
diff  --git a/libc/benchmarks/LibcBenchmark.h b/libc/benchmarks/LibcBenchmark.h
index e7be9c386f795..3b0a05136ca59 100644
--- a/libc/benchmarks/LibcBenchmark.h
+++ b/libc/benchmarks/LibcBenchmark.h
@@ -99,7 +99,7 @@ struct BenchmarkState {
 struct BenchmarkResult {
   BenchmarkStatus TerminationStatus = BenchmarkStatus::Running;
   Duration BestGuess = {};
-  llvm::Optional<llvm::SmallVector<BenchmarkState, 16>> MaybeBenchmarkLog;
+  std::optional<llvm::SmallVector<BenchmarkState, 16>> MaybeBenchmarkLog;
 };
 
 // Stores information about a cache in the host memory system.

diff  --git a/libc/benchmarks/LibcBenchmarkTest.cpp b/libc/benchmarks/LibcBenchmarkTest.cpp
index c9b21e48e8f70..41a246281efb5 100644
--- a/libc/benchmarks/LibcBenchmarkTest.cpp
+++ b/libc/benchmarks/LibcBenchmarkTest.cpp
@@ -78,7 +78,7 @@ class LibcBenchmark : public ::testing::Test {
 private:
   DummyParameterProvider ParameterProvider;
   static char DummyFunction(char Payload) { return Payload; }
-  llvm::Optional<std::queue<Duration>> MaybeTimepoints;
+  std::optional<std::queue<Duration>> MaybeTimepoints;
 };
 
 TEST_F(LibcBenchmark, MaxSamplesReached) {

diff  --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
index b113179348586..d0a356d11265c 100644
--- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -377,7 +377,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const FunctionType &T) {
 }
 template <typename T>
 static raw_ostream &operator<<(raw_ostream &Stream,
-                               const llvm::Optional<T> &MaybeT) {
+                               const std::optional<T> &MaybeT) {
   if (MaybeT)
     return Stream << *MaybeT;
   return Stream << "std::nullopt";

diff  --git a/libc/utils/LibcTableGenUtil/APIIndexer.h b/libc/utils/LibcTableGenUtil/APIIndexer.h
index 12dab0faa45cb..d530dc7174555 100644
--- a/libc/utils/LibcTableGenUtil/APIIndexer.h
+++ b/libc/utils/LibcTableGenUtil/APIIndexer.h
@@ -21,7 +21,7 @@ namespace llvm_libc {
 
 class APIIndexer {
 private:
-  llvm::Optional<llvm::StringRef> StdHeader;
+  std::optional<llvm::StringRef> StdHeader;
 
   // TableGen classes in spec.td.
   llvm::Record *NamedTypeClass;


        


More information about the libc-commits mailing list