[Lldb-commits] [lldb] [lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (PR #133869)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 31 23:28:04 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Mats Jun Larsen (junlarsen)
<details>
<summary>Changes</summary>
Part of #<!-- -->123569
---
Full diff: https://github.com/llvm/llvm-project/pull/133869.diff
2 Files Affected:
- (modified) lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp (+2-2)
- (modified) lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (+3-3)
``````````diff
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();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/133869
More information about the lldb-commits
mailing list