Author: Nikita Popov Date: 2022-03-24T13:09:23+01:00 New Revision: 840bb725435c729f47458c48723d434ce45d57ee
URL: https://github.com/llvm/llvm-project/commit/840bb725435c729f47458c48723d434ce45d57ee DIFF: https://github.com/llvm/llvm-project/commit/840bb725435c729f47458c48723d434ce45d57ee.diff LOG: [lldb] Avoid pointer element type accesses Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp llvm/docs/OpaquePointers.rst Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 10d1e99d756f8..60fe84035a5b7 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1757,20 +1757,19 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) { llvm::Instruction *entry_instruction = llvm::cast<Instruction>( m_entry_instruction_finder.GetValue(function)); + Type *int8Ty = Type::getInt8Ty(function->getContext()); ConstantInt *offset_int( ConstantInt::get(offset_type, offset, true)); GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create( - argument->getType()->getPointerElementType(), argument, - offset_int, "", entry_instruction); + int8Ty, argument, offset_int, "", entry_instruction); if (name == m_result_name && !m_result_is_pointer) { BitCastInst *bit_cast = new BitCastInst( get_element_ptr, value->getType()->getPointerTo(), "", entry_instruction); - LoadInst *load = - new LoadInst(bit_cast->getType()->getPointerElementType(), - bit_cast, "", entry_instruction); + LoadInst *load = new LoadInst(value->getType(), bit_cast, "", + entry_instruction); return load; } else { diff --git a/llvm/docs/OpaquePointers.rst b/llvm/docs/OpaquePointers.rst index b13a82895edb3..2e15ce4f11946 100644 --- a/llvm/docs/OpaquePointers.rst +++ b/llvm/docs/OpaquePointers.rst @@ -204,8 +204,6 @@ open problems: * Some pointer element type uses remain in LLVM. -* Some pointer element type uses remain in LLDB. - * Some pointer element type uses remain in MLIR. * Some pointer element type uses remain in Polly. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits