[llvm] 7ef9530 - [ADT] Simplify StringSet::contains (NFC) (#157325)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 7 10:39:49 PDT 2025


Author: Kazu Hirata
Date: 2025-09-07T10:39:46-07:00
New Revision: 7ef9530213d64325810d320670b69c2805e72a80

URL: https://github.com/llvm/llvm-project/commit/7ef9530213d64325810d320670b69c2805e72a80
DIFF: https://github.com/llvm/llvm-project/commit/7ef9530213d64325810d320670b69c2805e72a80.diff

LOG: [ADT] Simplify StringSet::contains (NFC) (#157325)

We can use Base::contains.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/StringSet.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/StringSet.h b/llvm/include/llvm/ADT/StringSet.h
index 13d2c406c4ff2..b4853423a1ef3 100644
--- a/llvm/include/llvm/ADT/StringSet.h
+++ b/llvm/include/llvm/ADT/StringSet.h
@@ -57,7 +57,7 @@ class StringSet : public StringMap<std::nullopt_t, AllocatorTy> {
   }
 
   /// Check if the set contains the given \c key.
-  bool contains(StringRef key) const { return Base::FindKey(key) != -1; }
+  bool contains(StringRef key) const { return Base::contains(key); }
 };
 
 } // end namespace llvm


        


More information about the llvm-commits mailing list