From a2f9ca88758b3d6af268a692aa0cce274f19fd00 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 28 Nov 2022 15:24:16 -0500 Subject: [PATCH] Utils: Use StringRef and rename variable for clarity --- llvm/lib/Transforms/Utils/ModuleUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index 9e1492b97a86..da588b3445e7 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -21,7 +21,7 @@ using namespace llvm; #define DEBUG_TYPE "moduleutils" -static void appendToGlobalArray(const char *Array, Module &M, Function *F, +static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F, int Priority, Constant *Data) { IRBuilder<> IRB(M.getContext()); FunctionType *FnTy = FunctionType::get(IRB.getVoidTy(), false); @@ -31,7 +31,7 @@ static void appendToGlobalArray(const char *Array, Module &M, Function *F, SmallVector CurrentCtors; StructType *EltTy = StructType::get( IRB.getInt32Ty(), PointerType::getUnqual(FnTy), IRB.getInt8PtrTy()); - if (GlobalVariable *GVCtor = M.getNamedGlobal(Array)) { + if (GlobalVariable *GVCtor = M.getNamedGlobal(ArrayName)) { if (Constant *Init = GVCtor->getInitializer()) { unsigned n = Init->getNumOperands(); CurrentCtors.reserve(n + 1); @@ -59,7 +59,7 @@ static void appendToGlobalArray(const char *Array, Module &M, Function *F, // Create the new global variable and replace all uses of // the old global variable with the new one. (void)new GlobalVariable(M, NewInit->getType(), false, - GlobalValue::AppendingLinkage, NewInit, Array); + GlobalValue::AppendingLinkage, NewInit, ArrayName); } void llvm::appendToGlobalCtors(Module &M, Function *F, int Priority, Constant *Data) {