[llvm] [NFC][ModuleUtils] Rename test function (PR #101750)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 13:57:11 PDT 2024
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/101750
None
>From c1f3d4b19163a7758fd2532c676ccf5ca86fc62a Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 2 Aug 2024 13:56:56 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
.../Transforms/Utils/ModuleUtilsTest.cpp | 26 +++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/llvm/unittests/Transforms/Utils/ModuleUtilsTest.cpp b/llvm/unittests/Transforms/Utils/ModuleUtilsTest.cpp
index e1bc58fda0e38..faca3bc03f120 100644
--- a/llvm/unittests/Transforms/Utils/ModuleUtilsTest.cpp
+++ b/llvm/unittests/Transforms/Utils/ModuleUtilsTest.cpp
@@ -24,12 +24,12 @@ static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) {
return Mod;
}
-static int getUsedListSize(Module &M, StringRef Name) {
- auto *UsedList = M.getGlobalVariable(Name);
- if (!UsedList)
+static int getListSize(Module &M, StringRef Name) {
+ auto *List = M.getGlobalVariable(Name);
+ if (!List)
return 0;
- auto *UsedListBaseArrayType = cast<ArrayType>(UsedList->getValueType());
- return UsedListBaseArrayType->getNumElements();
+ auto *T = cast<ArrayType>(List->getValueType());
+ return T->getNumElements();
}
TEST(ModuleUtils, AppendToUsedList1) {
@@ -41,13 +41,13 @@ TEST(ModuleUtils, AppendToUsedList1) {
for (auto &G : M->globals()) {
Globals.push_back(&G);
}
- EXPECT_EQ(0, getUsedListSize(*M, "llvm.compiler.used"));
+ EXPECT_EQ(0, getListSize(*M, "llvm.compiler.used"));
appendToCompilerUsed(*M, Globals);
- EXPECT_EQ(1, getUsedListSize(*M, "llvm.compiler.used"));
+ EXPECT_EQ(1, getListSize(*M, "llvm.compiler.used"));
- EXPECT_EQ(0, getUsedListSize(*M, "llvm.used"));
+ EXPECT_EQ(0, getListSize(*M, "llvm.used"));
appendToUsed(*M, Globals);
- EXPECT_EQ(1, getUsedListSize(*M, "llvm.used"));
+ EXPECT_EQ(1, getListSize(*M, "llvm.used"));
}
TEST(ModuleUtils, AppendToUsedList2) {
@@ -59,11 +59,11 @@ TEST(ModuleUtils, AppendToUsedList2) {
for (auto &G : M->globals()) {
Globals.push_back(&G);
}
- EXPECT_EQ(0, getUsedListSize(*M, "llvm.compiler.used"));
+ EXPECT_EQ(0, getListSize(*M, "llvm.compiler.used"));
appendToCompilerUsed(*M, Globals);
- EXPECT_EQ(1, getUsedListSize(*M, "llvm.compiler.used"));
+ EXPECT_EQ(1, getListSize(*M, "llvm.compiler.used"));
- EXPECT_EQ(0, getUsedListSize(*M, "llvm.used"));
+ EXPECT_EQ(0, getListSize(*M, "llvm.used"));
appendToUsed(*M, Globals);
- EXPECT_EQ(1, getUsedListSize(*M, "llvm.used"));
+ EXPECT_EQ(1, getListSize(*M, "llvm.used"));
}
More information about the llvm-commits
mailing list