[llvm] [ADT] Use separate variables in a unit test for SmallPtrSet (NFC) (PR #131748)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 18 00:41:50 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/unittests/ADT/SmallPtrSetTest.cpp (+5-3) 


``````````diff
diff --git a/llvm/unittests/ADT/SmallPtrSetTest.cpp b/llvm/unittests/ADT/SmallPtrSetTest.cpp
index 2a634a68d6e66..fb002cce65092 100644
--- a/llvm/unittests/ADT/SmallPtrSetTest.cpp
+++ b/llvm/unittests/ADT/SmallPtrSetTest.cpp
@@ -412,11 +412,13 @@ TEST(SmallPtrSetTest, RemoveIf) {
 }
 
 TEST(SmallPtrSetTest, InsertRange) {
-  int Vals[3] = {0, 1, 2};
+  int V0 = 0;
+  int V1 = 1;
+  int V2 = 2;
   SmallPtrSet<int *, 4> Set;
-  int *Args[] = {&Vals[2], &Vals[0], &Vals[1]};
+  int *Args[] = {&V2, &V0, &V1};
   Set.insert_range(Args);
-  EXPECT_THAT(Set, UnorderedElementsAre(&Vals[0], &Vals[1], &Vals[2]));
+  EXPECT_THAT(Set, UnorderedElementsAre(&V0, &V1, &V2));
 }
 
 TEST(SmallPtrSetTest, Reserve) {

``````````

</details>


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


More information about the llvm-commits mailing list