[llvm] Add support for hashing std::optional
authorKazu Hirata <kazu@google.com>
Sat, 3 Dec 2022 02:53:00 +0000 (18:53 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 3 Dec 2022 02:53:00 +0000 (18:53 -0800)
commitf64d4a26cee0030e4dd70ef74683254ec23fca4c
tree591fb697d17983702be00ca18479ca7a9f183020
parent8a1f12c6fbe9da8dcb6102d3b9b695cfcae9dbb4
[llvm] Add support for hashing std::optional

The credit for the hashing code, taken from D138934, goes to Ramkumar
Ramachandra.  The test comes from OptionalTest.cpp and updated for
std::optional.

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/D139240
llvm/include/llvm/ADT/Hashing.h
llvm/unittests/ADT/HashingTest.cpp