Author: Adrian Prantl Date: 2022-06-02T11:42:28-07:00 New Revision: 8eed95c83ecd0e42eaaca4f6591faafa4dad0d88
URL: https://github.com/llvm/llvm-project/commit/8eed95c83ecd0e42eaaca4f6591faafa4dad0d88 DIFF: https://github.com/llvm/llvm-project/commit/8eed95c83ecd0e42eaaca4f6591faafa4dad0d88.diff LOG: Adapt IRForTarget::RewriteObjCSelector() for D126689. With opaque pointers, the LLVM IR expected by this function changed. Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 60fe84035a5b7..bd30ab546d4b8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -758,17 +758,16 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { // Unpack the message name from the selector. In LLVM IR, an objc_msgSend // gets represented as // - // %tmp = load i8** @"OBJC_SELECTOR_REFERENCES_" ; <i8*> %call = call - // i8* (i8*, i8*, ...)* @objc_msgSend(i8* %obj, i8* %tmp, ...) ; <i8*> + // %sel = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8 + // call i8 @objc_msgSend(ptr %obj, ptr %sel, ...) // - // where %obj is the object pointer and %tmp is the selector. + // where %obj is the object pointer and %sel is the selector. // // @"OBJC_SELECTOR_REFERENCES_" is a pointer to a character array called // @"\01L_OBJC_llvm_moduleETH_VAR_NAllvm_moduleE_". // @"\01L_OBJC_llvm_moduleETH_VAR_NAllvm_moduleE_" contains the string. - // Find the pointer's initializer (a ConstantExpr with opcode GetElementPtr) - // and get the string from its target + // Find the pointer's initializer and get the string from its target. GlobalVariable *_objc_selector_references_ = dyn_cast<GlobalVariable>(load->getPointerOperand()); @@ -778,22 +777,13 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { return false; Constant *osr_initializer = _objc_selector_references_->getInitializer(); - - ConstantExpr *osr_initializer_expr = dyn_cast<ConstantExpr>(osr_initializer); - - if (!osr_initializer_expr || - osr_initializer_expr->getOpcode() != Instruction::GetElementPtr) - return false; - - Value *osr_initializer_base = osr_initializer_expr->getOperand(0); - - if (!osr_initializer_base) + if (!osr_initializer) return false; // Find the string's initializer (a ConstantArray) and get the string from it GlobalVariable *_objc_meth_var_name_ = - dyn_cast<GlobalVariable>(osr_initializer_base); + dyn_cast<GlobalVariable>(osr_initializer); if (!_objc_meth_var_name_ || !_objc_meth_var_name_->hasInitializer()) return false; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits