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

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 2 04:23:35 PST 2023


steakhal added a comment.
Herald added a subscriber: thopre.

This patch breaks `llvm::StringSet` equality.
The following code would no longer compile:

  llvm::StringSet LHS;
  llvm::StringSet RHS;
  bool equal = LHS == RHS;

Such code might be used as gtest assertions like `EXPECT_EQ(LHS, RHS)`.
@kazu Do you think we should address this by providing an equality operator for the `StringSet`?
I was thinking of adding this:

  bool operator==(const StringSet &RHS) const {
    if (Base::size() != RHS.size())
      return false;
  
    // For StringSets we only need to check the keys.
    for (const auto &KeyValue : *this) {
      if (RHS.find(KeyValue.getKey()) == RHS.end())
        return false;
    }
    return true;
  };

Do you think we should backport this to `release/16.x`, given that this could break downstream users and that llvm-16.0.0 is not released yet?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138539



More information about the cfe-commits mailing list