[clang] [llvm] fix-add-immutable-set (PR #159845)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 13:31:55 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 origin/main HEAD --extensions cpp,h -- clang/lib/Analysis/LifetimeSafety.cpp llvm/include/llvm/ADT/ImmutableSet.h llvm/unittests/ADT/ImmutableSetTest.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/include/llvm/ADT/ImmutableSet.h b/llvm/include/llvm/ADT/ImmutableSet.h
index c2d84d86b..017585a47 100644
--- a/llvm/include/llvm/ADT/ImmutableSet.h
+++ b/llvm/include/llvm/ADT/ImmutableSet.h
@@ -566,7 +566,7 @@ protected:
   ///  from the original tree except the specified data.  If the
   ///  specified data did not exist in the original tree, the original
   ///  tree is returned.
-    TreeTy* remove_internal(key_type_ref K, TreeTy* T) {
+  TreeTy *remove_internal(key_type_ref K, TreeTy *T) {
     if (isEmpty(T))
       return T;
 
@@ -586,8 +586,9 @@ protected:
 
     // If no changes were made, return the original tree. Otherwise, balance the
     // tree and return the new root.
-    return NewL == getLeft(T) && NewR == getRight(T) ? T
-                                               : balanceTree(NewL, getValue(T), NewR);
+    return NewL == getLeft(T) && NewR == getRight(T)
+               ? T
+               : balanceTree(NewL, getValue(T), NewR);
   }
 
   TreeTy* combineTrees(TreeTy* L, TreeTy* R) {
diff --git a/llvm/unittests/ADT/ImmutableSetTest.cpp b/llvm/unittests/ADT/ImmutableSetTest.cpp
index c85a642d0..18815ac5e 100644
--- a/llvm/unittests/ADT/ImmutableSetTest.cpp
+++ b/llvm/unittests/ADT/ImmutableSetTest.cpp
@@ -182,7 +182,6 @@ TEST_F(ImmutableSetTest, AddIfNotFoundTest) {
   EXPECT_NE(S.getRoot(), U.getRoot());
 }
 
-
 TEST_F(ImmutableSetTest, RemoveIfNotFoundTest) {
   ImmutableSet<long>::Factory f(/*canonicalize=*/false);
   ImmutableSet<long> S = f.getEmptySet();
@@ -196,5 +195,4 @@ TEST_F(ImmutableSetTest, RemoveIfNotFoundTest) {
   ImmutableSet<long> U = f.remove(S, 3);
   EXPECT_NE(S.getRoot(), U.getRoot());
 }
-
 }

``````````

</details>


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


More information about the cfe-commits mailing list