[Lldb-commits] [lldb] [lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (PR #133869)

2025-03-31 Thread Mats Jun Larsen via lldb-commits

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 
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();
 }

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (PR #133869)

2025-03-31 Thread Mats Jun Larsen via lldb-commits

junlarsen wrote:

* **#133869** https://app.graphite.dev/github/pr/llvm/llvm-project/133869?utm_source=stack-comment-icon";
 target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" 
width="10px" height="10px"/> 👈 https://app.graphite.dev/github/pr/llvm/llvm-project/133869?utm_source=stack-comment-view-in-graphite";
 target="_blank">(View in Graphite)
* `main`




This stack of pull requests is managed by https://graphite.dev?utm-source=stack-comment";>Graphite. Learn 
more about https://stacking.dev/?utm_source=stack-comment";>stacking.


https://github.com/llvm/llvm-project/pull/133869
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (PR #133869)

2025-04-01 Thread Mats Jun Larsen via lldb-commits

https://github.com/junlarsen closed 
https://github.com/llvm/llvm-project/pull/133869
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits