Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

While I am at it, this patch adds [[nodiscard]].

While I am at it, this patch adds [[nodiscard]].
@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

While I am at it, this patch adds [[nodiscard]].


Full diff: https://github.com/llvm/llvm-project/pull/161120.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/EquivalenceClasses.h (+2-2)
diff --git a/llvm/include/llvm/ADT/EquivalenceClasses.h b/llvm/include/llvm/ADT/EquivalenceClasses.h
index 1a2331c1a0322..7df0d1557af87 100644
--- a/llvm/include/llvm/ADT/EquivalenceClasses.h
+++ b/llvm/include/llvm/ADT/EquivalenceClasses.h
@@ -180,8 +180,8 @@ template <class ElemTy> class EquivalenceClasses {
   }
 
   /// Returns true if \p V is contained an equivalence class.
-  bool contains(const ElemTy &V) const {
-    return TheMapping.find(V) != TheMapping.end();
+  [[nodiscard]] bool contains(const ElemTy &V) const {
+    return TheMapping.contains(V);
   }
 
   /// getLeaderValue - Return the leader for the specified value that is in the

@kazutakahirata kazutakahirata merged commit c4a5519 into llvm:main Sep 29, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250928_ADT_EquivalenceClasses_contains branch September 29, 2025 14:55
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
While I am at it, this patch adds [[nodiscard]].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants