[llvm] fix some warnings in SmallPtrSetTest (PR #77956)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 10:16:14 PST 2024


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 2f2217a8f7ad68b2d9374e0515f02e6752acd126 87c342030c194719bc00cc6ff30dcd21e62f825b -- llvm/unittests/ADT/SmallPtrSetTest.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/unittests/ADT/SmallPtrSetTest.cpp b/llvm/unittests/ADT/SmallPtrSetTest.cpp
index 7a71caaa23..b1c0be714f 100644
--- a/llvm/unittests/ADT/SmallPtrSetTest.cpp
+++ b/llvm/unittests/ADT/SmallPtrSetTest.cpp
@@ -56,8 +56,8 @@ TEST(SmallPtrSetTest, Assignment) {
 TEST(SmallPtrSetTest, GrowthTest) {
   int i;
   int buf[8];
-  for(i=0; i<8; ++i) {
-    buf[i]=0;
+  for (i = 0; i < 8; ++i) {
+    buf[i] = 0;
   }
 
   SmallPtrSet<int *, 4> s;
@@ -70,8 +70,8 @@ TEST(SmallPtrSetTest, GrowthTest) {
   EXPECT_EQ(4U, s.size());
 
   i = 0;
-  for(iter I=s.begin(), E=s.end(); I!=E; ++I, ++i) {
-      (**I)++;
+  for (iter I = s.begin(), E = s.end(); I != E; ++I, ++i) {
+    (**I)++;
   }
   EXPECT_EQ(4, i);
   for(i=0; i<8; ++i)
@@ -83,8 +83,8 @@ TEST(SmallPtrSetTest, GrowthTest) {
   s.insert(&buf[7]);
 
   i = 0;
-  for(iter I=s.begin(), E=s.end(); I!=E; ++I, ++i) {
-      (**I)++;
+  for (iter I = s.begin(), E = s.end(); I != E; ++I, ++i) {
+    (**I)++;
   }
   EXPECT_EQ(8, i);
   s.erase(&buf[4]);
@@ -94,27 +94,27 @@ TEST(SmallPtrSetTest, GrowthTest) {
   EXPECT_EQ(4U, s.size());
 
   i = 0;
-  for(iter I=s.begin(), E=s.end(); I!=E; ++I, ++i) {
-      (**I)++;
+  for (iter I = s.begin(), E = s.end(); I != E; ++I, ++i) {
+    (**I)++;
   }
   EXPECT_EQ(4, i);
-  for(i=0; i<8; ++i) {
-      EXPECT_EQ(i<4?3:1,buf[i]);
+  for (i = 0; i < 8; ++i) {
+    EXPECT_EQ(i < 4 ? 3 : 1, buf[i]);
   }
 
   s.clear();
-  for(i=0; i<8; ++i) {
-    buf[i]=0;
+  for (i = 0; i < 8; ++i) {
+    buf[i] = 0;
   }
-  for(i=0; i<128; ++i) {
-    s.insert(&buf[i%8]); // test repeated entires
+  for (i = 0; i < 128; ++i) {
+    s.insert(&buf[i % 8]); // test repeated entires
   }
   EXPECT_EQ(8U, s.size());
-  for(iter I=s.begin(), E=s.end(); I!=E; ++I, ++i) {
-      (**I)++;
+  for (iter I = s.begin(), E = s.end(); I != E; ++I, ++i) {
+    (**I)++;
   }
-  for(i=0; i<8; ++i) {
-      EXPECT_EQ(1,buf[i]);
+  for (i = 0; i < 8; ++i) {
+    EXPECT_EQ(1, buf[i]);
   }
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list