aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Core.cpp
diff options
context:
space:
mode:
authorVasileios Porpodas <vporpodas@google.com>2022-12-12 14:57:47 -0800
committerVasileios Porpodas <vporpodas@google.com>2022-12-12 20:22:55 -0800
commita19ae77d2a9016428fee7cd5af03fd20ad6d4464 (patch)
tree68a8db9ead83aef2289609fac4be9bbf22828a8c /llvm/lib/IR/Core.cpp
parent1bf261c89b96df33ed14c6695f5f8590578e825d (diff)
downloadllvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.zip
llvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.tar.gz
llvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.tar.bz2
[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlockList().insert()
This is part of a series of patches that aim at making Function::getBasicBlockList() private. Differential Revision: https://reviews.llvm.org/D139906
Diffstat (limited to 'llvm/lib/IR/Core.cpp')
-rw-r--r--llvm/lib/IR/Core.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index f376bfb..d642d41 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2655,13 +2655,14 @@ void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder,
BasicBlock *ToInsert = unwrap(BB);
BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock();
assert(CurBB && "current insertion point is invalid!");
- CurBB->getParent()->getBasicBlockList().insertAfter(CurBB->getIterator(),
- ToInsert);
+ CurBB->getParent()->insertBasicBlockAt(std::next(CurBB->getIterator()),
+ ToInsert);
}
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn,
LLVMBasicBlockRef BB) {
- unwrap<Function>(Fn)->getBasicBlockList().push_back(unwrap(BB));
+ unwrap<Function>(Fn)->insertBasicBlockAt(unwrap<Function>(Fn)->end(),
+ unwrap(BB));
}
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,