[PATCH] D138539: Use std::nullopt_t instead of NoneType (NFC)

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 12:29:10 PST 2023


MaskRay added a comment.

In D138539#4164313 <https://reviews.llvm.org/D138539#4164313>, @steakhal wrote:

> Oh, I forgot to mention why this change breaks the equality operator of `llvm::StringSet`. It's because the `StringMap::operator==` will try to compare the `value` as well, which is of type `std::nullopt_t` and that has no equality comparison operator.
> Previously, the `enum class NoneType` has a default one.

Since `std::unordered_set` and counterparts like `absl::flat_hash_set` provide `operator==`, I think providing `StringMap::operator==` is fine. I don't think whether the operation is commonly used, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138539/new/

https://reviews.llvm.org/D138539



More information about the llvm-commits mailing list