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