From b5516be05654ecdd4fd7e317b1f21f940c1a967b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 14 Jan 2023 20:52:00 -0800 Subject: [PATCH] [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 --- libc/benchmarks/LibcBenchmark.h | 2 +- libc/benchmarks/LibcBenchmarkTest.cpp | 2 +- .../include/automemcpy/FunctionDescriptor.h | 12 ++++++------ .../include/automemcpy/RandomFunctionGenerator.h | 4 ++-- libc/benchmarks/automemcpy/lib/CodeGen.cpp | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libc/benchmarks/LibcBenchmark.h b/libc/benchmarks/LibcBenchmark.h index 3b0a05136ca5..0a0b40f924e6 100644 --- a/libc/benchmarks/LibcBenchmark.h +++ b/libc/benchmarks/LibcBenchmark.h @@ -32,12 +32,12 @@ #include "benchmark/benchmark.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include #include #include #include +#include namespace llvm { namespace libc_benchmarks { diff --git a/libc/benchmarks/LibcBenchmarkTest.cpp b/libc/benchmarks/LibcBenchmarkTest.cpp index 41a246281efb..f3d456479741 100644 --- a/libc/benchmarks/LibcBenchmarkTest.cpp +++ b/libc/benchmarks/LibcBenchmarkTest.cpp @@ -8,12 +8,12 @@ #include "LibcBenchmark.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include #include +#include #include #include diff --git a/libc/benchmarks/automemcpy/include/automemcpy/FunctionDescriptor.h b/libc/benchmarks/automemcpy/include/automemcpy/FunctionDescriptor.h index 444d856a7260..65477d9d72a0 100644 --- a/libc/benchmarks/automemcpy/include/automemcpy/FunctionDescriptor.h +++ b/libc/benchmarks/automemcpy/include/automemcpy/FunctionDescriptor.h @@ -13,8 +13,8 @@ #include #include #include -#include #include +#include #include namespace llvm { @@ -127,11 +127,11 @@ enum class FunctionType { // every detail but is enough to uniquely identify the implementation. struct FunctionDescriptor { FunctionType Type; - Optional Contiguous; - Optional Overlap; - Optional Loop; - Optional AlignedLoop; - Optional Accelerator; + std::optional Contiguous; + std::optional Overlap; + std::optional Loop; + std::optional AlignedLoop; + std::optional Accelerator; ElementTypeClass ElementClass; COMPARABLE_AND_HASHABLE(FunctionDescriptor, Type, Contiguous, Overlap, Loop, diff --git a/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h b/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h index 4fa1c3843a0e..28756e8f86c0 100644 --- a/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h +++ b/libc/benchmarks/automemcpy/include/automemcpy/RandomFunctionGenerator.h @@ -13,8 +13,8 @@ #include #include #include -#include #include +#include #include #include @@ -27,7 +27,7 @@ struct RandomFunctionGenerator { RandomFunctionGenerator(); // Get the next valid FunctionDescriptor or std::nullopt. - Optional next(); + std::optional next(); private: // Returns an expression where `Variable` is forced to be one of the `Values`. diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp index d0a356d11265..f4060099bddd 100644 --- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp +++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp @@ -37,11 +37,11 @@ #include "automemcpy/CodeGen.h" #include -#include #include #include #include #include +#include #include namespace llvm { @@ -126,9 +126,9 @@ struct FunctionImplementation { StringRef Name; std::vector Individuals; std::vector Overlaps; - Optional Loop; - Optional AlignedLoop; - Optional Accelerator; + std::optional Loop; + std::optional AlignedLoop; + std::optional Accelerator; ElementTypeClass ElementClass; };