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

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


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

None

>From 03d2009b9038a187dd1993daeaf67db96316dc57 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 18 Mar 2025 00:32:17 -0700
Subject: [PATCH] [ADT] Use separate variables in a unit test for SmallPtrSet
 (NFC)

---
 llvm/unittests/ADT/SmallPtrSetTest.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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) {



More information about the llvm-commits mailing list