[llvm] [EquivalenceClasses] Introduce erase member function (PR #134660)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 07:42:20 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/ADT/EquivalenceClasses.h llvm/unittests/ADT/EquivalenceClassesTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/ADT/EquivalenceClasses.h b/llvm/include/llvm/ADT/EquivalenceClasses.h
index e2e6b6269..87ff9fafb 100644
--- a/llvm/include/llvm/ADT/EquivalenceClasses.h
+++ b/llvm/include/llvm/ADT/EquivalenceClasses.h
@@ -222,14 +222,15 @@ public:
 
   /// erase - Erase a value from the union/find set, return if erase succeed.
   bool erase(const ElemTy &V) {
-    if (!TheMapping.contains(V)) return false;
+    if (!TheMapping.contains(V))
+      return false;
     const ECValue *cur = TheMapping[V];
     const ECValue *next = cur->getNext();
     if (cur->isLeader()) {
       if (next) {
         next->Leader = cur->Leader;
         auto nn = next->Next;
-        next->Next = (const ECValue*)((intptr_t)nn | (intptr_t)1);
+        next->Next = (const ECValue *)((intptr_t)nn | (intptr_t)1);
       }
     } else {
       const ECValue *leader = findLeader(V).Node;
@@ -241,7 +242,8 @@ public:
         pre->Next = nullptr;
         leader->Leader = pre;
       } else {
-        pre->Next = (const ECValue*)((intptr_t)next | (intptr_t)pre->isLeader());
+        pre->Next =
+            (const ECValue *)((intptr_t)next | (intptr_t)pre->isLeader());
         next->Leader = pre;
       }
     }

``````````

</details>


https://github.com/llvm/llvm-project/pull/134660


More information about the llvm-commits mailing list