Skip to content

Commit 382854d

Browse files
committed
[lldb] Use BasicBlock::iterator instead of InsertPosition (NFC) (llvm#112307)
InsertPosition has been deprecated in favor of using BasicBlock::iterator. (See llvm#102608) (cherry picked from commit 74eb079)
1 parent 97d0113 commit 382854d

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ class ValidPointerChecker : public Instrumenter {
331331
return false;
332332

333333
// Insert an instruction to call the helper with the result
334-
CallInst::Create(m_valid_pointer_check_func, dereferenced_ptr, "", inst);
334+
CallInst::Create(m_valid_pointer_check_func, dereferenced_ptr, "",
335+
inst->getIterator());
335336

336337
return true;
337338
}
@@ -418,7 +419,7 @@ class ObjcObjectChecker : public Instrumenter {
418419

419420
ArrayRef<llvm::Value *> args(arg_array, 2);
420421

421-
CallInst::Create(m_objc_object_check_func, args, "", inst);
422+
CallInst::Create(m_objc_object_check_func, args, "", inst->getIterator());
422423

423424
return true;
424425
}

lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
381381

382382
Constant *initializer = result_global->getInitializer();
383383

384-
StoreInst *synthesized_store =
385-
new StoreInst(initializer, new_result_global, first_entry_instruction);
384+
StoreInst *synthesized_store = new StoreInst(
385+
initializer, new_result_global, first_entry_instruction->getIterator());
386386

387387
LLDB_LOG(log, "Synthesized result store \"{0}\"\n",
388388
PrintValue(synthesized_store));
@@ -416,9 +416,8 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
416416
"CFStringCreateWithBytes");
417417

418418
bool missing_weak = false;
419-
CFStringCreateWithBytes_addr =
420-
m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str,
421-
missing_weak);
419+
CFStringCreateWithBytes_addr = m_execution_unit.FindSymbol(
420+
g_CFStringCreateWithBytes_str, missing_weak);
422421
if (CFStringCreateWithBytes_addr == LLDB_INVALID_ADDRESS || missing_weak) {
423422
LLDB_LOG(log, "Couldn't find CFStringCreateWithBytes in the target");
424423

@@ -517,7 +516,8 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
517516
m_CFStringCreateWithBytes, CFSCWB_arguments,
518517
"CFStringCreateWithBytes",
519518
llvm::cast<Instruction>(
520-
m_entry_instruction_finder.GetValue(function)));
519+
m_entry_instruction_finder.GetValue(function))
520+
->getIterator());
521521
});
522522

523523
if (!UnfoldConstant(ns_str, nullptr, CFSCWB_Caller, m_entry_instruction_finder,
@@ -824,7 +824,7 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
824824

825825
CallInst *srN_call =
826826
CallInst::Create(m_sel_registerName, _objc_meth_var_name_,
827-
"sel_registerName", selector_load);
827+
"sel_registerName", selector_load->getIterator());
828828

829829
// Replace the load with the call in all users
830830

@@ -917,8 +917,9 @@ bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) {
917917
// Now, since the variable is a pointer variable, we will drop in a load of
918918
// that pointer variable.
919919

920-
LoadInst *persistent_load = new LoadInst(persistent_global->getValueType(),
921-
persistent_global, "", alloc);
920+
LoadInst *persistent_load =
921+
new LoadInst(persistent_global->getValueType(), persistent_global, "",
922+
alloc->getIterator());
922923

923924
LLDB_LOG(log, "Replacing \"{0}\" with \"{1}\"", PrintValue(alloc),
924925
PrintValue(persistent_load));
@@ -1344,8 +1345,10 @@ bool IRForTarget::UnfoldConstant(Constant *old_constant,
13441345

13451346
return new BitCastInst(
13461347
value_maker.GetValue(function), constant_expr->getType(),
1347-
"", llvm::cast<Instruction>(
1348-
entry_instruction_finder.GetValue(function)));
1348+
"",
1349+
llvm::cast<Instruction>(
1350+
entry_instruction_finder.GetValue(function))
1351+
->getIterator());
13491352
});
13501353

13511354
if (!UnfoldConstant(constant_expr, llvm_function, bit_cast_maker,
@@ -1379,7 +1382,8 @@ bool IRForTarget::UnfoldConstant(Constant *old_constant,
13791382
return GetElementPtrInst::Create(
13801383
gep->getSourceElementType(), ptr, indices, "",
13811384
llvm::cast<Instruction>(
1382-
entry_instruction_finder.GetValue(function)));
1385+
entry_instruction_finder.GetValue(function))
1386+
->getIterator());
13831387
});
13841388

13851389
if (!UnfoldConstant(constant_expr, llvm_function,
@@ -1559,12 +1563,14 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
15591563
Type *int8Ty = Type::getInt8Ty(function->getContext());
15601564
ConstantInt *offset_int(
15611565
ConstantInt::get(offset_type, offset, true));
1562-
GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(
1563-
int8Ty, argument, offset_int, "", entry_instruction);
1566+
GetElementPtrInst *get_element_ptr =
1567+
GetElementPtrInst::Create(int8Ty, argument, offset_int, "",
1568+
entry_instruction->getIterator());
15641569

15651570
if (name == m_result_name && !m_result_is_pointer) {
1566-
LoadInst *load = new LoadInst(value->getType(), get_element_ptr,
1567-
"", entry_instruction);
1571+
LoadInst *load =
1572+
new LoadInst(value->getType(), get_element_ptr, "",
1573+
entry_instruction->getIterator());
15681574

15691575
return load;
15701576
} else {

0 commit comments

Comments
 (0)