diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-14 14:51:05 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-14 14:51:05 -0800 |
commit | 21a3447564735833909b14b681454997991f35f8 (patch) | |
tree | b20eb449f57f652eccfd742ac622ef8a673c298e /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | 71b3a0d1460ffe618bb38f0992ee970d74c3ec50 (diff) | |
download | llvm-21a3447564735833909b14b681454997991f35f8.zip llvm-21a3447564735833909b14b681454997991f35f8.tar.gz llvm-21a3447564735833909b14b681454997991f35f8.tar.bz2 |
[Support] Add llvm::transformOptional
llvm::Optional<T> has transform, which is equivalent to
std::optional<T>::transform. The problem is that
std::optional<T>::transform won't be available until C++23, implying
that we probably cannot use it in our codebase untli 2028 or so. We
certainly don't want to keep llvm::Optional just for transform.
This patch adds llvm::transformOptional to STLForwardCompat.h so that
we can use transform during the migration to std::optional and beyond.
I've shamelessly borrowed the implementation and test from
llvm/include/llvm/ADT/Optional.h and
llvm/unittests/ADT/OptionalTest.cpp respectively.
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
Differential Revision: https://reviews.llvm.org/D139779
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
0 files changed, 0 insertions, 0 deletions