Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC][ModuleUtils] Rename test function #101750

Merged

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Aug 2, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Vitaly Buka (vitalybuka)

Changes

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

1 Files Affected:

  • (modified) llvm/unittests/Transforms/Utils/ModuleUtilsTest.cpp (+13-13)
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"));
 }

@vitalybuka vitalybuka merged commit 88ef76c into main Aug 2, 2024
7 of 8 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcmoduleutils-rename-test-function branch August 2, 2024 22:35
banach-space pushed a commit to banach-space/llvm-project that referenced this pull request Aug 7, 2024
kstoimenov pushed a commit to kstoimenov/llvm-project that referenced this pull request Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants