Skip to content

Commit 5623a9f

Browse files
JDevlieghereDanielCChen
authored andcommitted
[lldb] Use BasicBlock::iterator instead of InsertPosition (NFC) (llvm#112307)
InsertPosition has been deprecated in favor of using BasicBlock::iterator. (See llvm#102608)
1 parent b5d2a93 commit 5623a9f

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
@@ -330,7 +330,8 @@ class ValidPointerChecker : public Instrumenter {
330330
return false;
331331

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

335336
return true;
336337
}
@@ -417,7 +418,7 @@ class ObjcObjectChecker : public Instrumenter {
417418

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

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

422423
return true;
423424
}

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

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

379379
Constant *initializer = result_global->getInitializer();
380380

381-
StoreInst *synthesized_store =
382-
new StoreInst(initializer, new_result_global, first_entry_instruction);
381+
StoreInst *synthesized_store = new StoreInst(
382+
initializer, new_result_global, first_entry_instruction->getIterator());
383383

384384
LLDB_LOG(log, "Synthesized result store \"{0}\"\n",
385385
PrintValue(synthesized_store));
@@ -413,9 +413,8 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
413413
"CFStringCreateWithBytes");
414414

415415
bool missing_weak = false;
416-
CFStringCreateWithBytes_addr =
417-
m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str,
418-
missing_weak);
416+
CFStringCreateWithBytes_addr = m_execution_unit.FindSymbol(
417+
g_CFStringCreateWithBytes_str, missing_weak);
419418
if (CFStringCreateWithBytes_addr == LLDB_INVALID_ADDRESS || missing_weak) {
420419
LLDB_LOG(log, "Couldn't find CFStringCreateWithBytes in the target");
421420

@@ -514,7 +513,8 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str,
514513
m_CFStringCreateWithBytes, CFSCWB_arguments,
515514
"CFStringCreateWithBytes",
516515
llvm::cast<Instruction>(
517-
m_entry_instruction_finder.GetValue(function)));
516+
m_entry_instruction_finder.GetValue(function))
517+
->getIterator());
518518
});
519519

520520
if (!UnfoldConstant(ns_str, nullptr, CFSCWB_Caller, m_entry_instruction_finder,
@@ -821,7 +821,7 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
821821

822822
CallInst *srN_call =
823823
CallInst::Create(m_sel_registerName, _objc_meth_var_name_,
824-
"sel_registerName", selector_load);
824+
"sel_registerName", selector_load->getIterator());
825825

826826
// Replace the load with the call in all users
827827

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

917-
LoadInst *persistent_load = new LoadInst(persistent_global->getValueType(),
918-
persistent_global, "", alloc);
917+
LoadInst *persistent_load =
918+
new LoadInst(persistent_global->getValueType(), persistent_global, "",
919+
alloc->getIterator());
919920

920921
LLDB_LOG(log, "Replacing \"{0}\" with \"{1}\"", PrintValue(alloc),
921922
PrintValue(persistent_load));
@@ -1341,8 +1342,10 @@ bool IRForTarget::UnfoldConstant(Constant *old_constant,
13411342

13421343
return new BitCastInst(
13431344
value_maker.GetValue(function), constant_expr->getType(),
1344-
"", llvm::cast<Instruction>(
1345-
entry_instruction_finder.GetValue(function)));
1345+
"",
1346+
llvm::cast<Instruction>(
1347+
entry_instruction_finder.GetValue(function))
1348+
->getIterator());
13461349
});
13471350

13481351
if (!UnfoldConstant(constant_expr, llvm_function, bit_cast_maker,
@@ -1376,7 +1379,8 @@ bool IRForTarget::UnfoldConstant(Constant *old_constant,
13761379
return GetElementPtrInst::Create(
13771380
gep->getSourceElementType(), ptr, indices, "",
13781381
llvm::cast<Instruction>(
1379-
entry_instruction_finder.GetValue(function)));
1382+
entry_instruction_finder.GetValue(function))
1383+
->getIterator());
13801384
});
13811385

13821386
if (!UnfoldConstant(constant_expr, llvm_function,
@@ -1556,12 +1560,14 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) {
15561560
Type *int8Ty = Type::getInt8Ty(function->getContext());
15571561
ConstantInt *offset_int(
15581562
ConstantInt::get(offset_type, offset, true));
1559-
GetElementPtrInst *get_element_ptr = GetElementPtrInst::Create(
1560-
int8Ty, argument, offset_int, "", entry_instruction);
1563+
GetElementPtrInst *get_element_ptr =
1564+
GetElementPtrInst::Create(int8Ty, argument, offset_int, "",
1565+
entry_instruction->getIterator());
15611566

15621567
if (name == m_result_name && !m_result_is_pointer) {
1563-
LoadInst *load = new LoadInst(value->getType(), get_element_ptr,
1564-
"", entry_instruction);
1568+
LoadInst *load =
1569+
new LoadInst(value->getType(), get_element_ptr, "",
1570+
entry_instruction->getIterator());
15651571

15661572
return load;
15671573
} else {

0 commit comments

Comments
 (0)