[Lldb-commits] [lldb] [lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (PR #133869)
Mats Jun Larsen via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 31 23:27:28 PDT 2025
https://github.com/junlarsen created https://github.com/llvm/llvm-project/pull/133869
Part of #123569
>From 84298350a0cab997d4d98ae16f6203a07cfcbb13 Mon Sep 17 00:00:00 2001
From: Mats Jun Larsen <mats at jun.codes>
Date: Mon, 31 Mar 2025 18:57:35 +0200
Subject: [PATCH] [lldb] Prefer PointerType::get with LLVMContext over Type
(NFC)
Part of #123569
---
.../Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp | 4 ++--
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
index ae0682d717948..c7c292a8a7e42 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
@@ -240,7 +240,7 @@ class Instrumenter {
FunctionType *fun_ty = FunctionType::get(
llvm::Type::getVoidTy(m_module.getContext()), params, true);
- PointerType *fun_ptr_ty = PointerType::getUnqual(fun_ty);
+ PointerType *fun_ptr_ty = PointerType::getUnqual(m_module.getContext());
Constant *fun_addr_int =
ConstantInt::get(GetIntptrTy(), start_address, false);
return {fun_ty, ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty)};
@@ -264,7 +264,7 @@ class Instrumenter {
FunctionType *fun_ty = FunctionType::get(
llvm::Type::getVoidTy(m_module.getContext()), params, true);
- PointerType *fun_ptr_ty = PointerType::getUnqual(fun_ty);
+ PointerType *fun_ptr_ty = PointerType::getUnqual(m_module.getContext());
Constant *fun_addr_int =
ConstantInt::get(GetIntptrTy(), start_address, false);
return {fun_ty, ConstantExpr::getIntToPtr(fun_addr_int, fun_ptr_ty)};
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 879f006336ba5..a343766ce9c4f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -462,7 +462,7 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
FunctionType::get(ns_str_ty, CFSCWB_arg_types, false);
// Build the constant containing the pointer to the function
- PointerType *CFSCWB_ptr_ty = PointerType::getUnqual(CFSCWB_ty);
+ PointerType *CFSCWB_ptr_ty = PointerType::getUnqual(m_module->getContext());
Constant *CFSCWB_addr_int =
ConstantInt::get(m_intptr_ty, CFStringCreateWithBytes_addr, false);
m_CFStringCreateWithBytes = {
@@ -814,7 +814,7 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
FunctionType::get(sel_ptr_type, srN_arg_types, false);
// Build the constant containing the pointer to the function
- PointerType *srN_ptr_ty = PointerType::getUnqual(srN_type);
+ PointerType *srN_ptr_ty = PointerType::getUnqual(m_module->getContext());
Constant *srN_addr_int =
ConstantInt::get(m_intptr_ty, sel_registerName_addr, false);
m_sel_registerName = {srN_type,
@@ -1031,7 +1031,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
//
// We also do this for any user-declared persistent variables.
compiler_type = compiler_type.GetPointerType();
- value_type = PointerType::get(global_variable->getType(), 0);
+ value_type = PointerType::getUnqual(global_variable->getContext());
} else {
value_type = global_variable->getType();
}
More information about the lldb-commits
mailing list