aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.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 /clang/lib/CodeGen/CodeGenFunction.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 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index a84f129..09dc638a 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -319,8 +319,10 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() {
static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) {
if (!BB) return;
- if (!BB->use_empty())
- return CGF.CurFn->getBasicBlockList().push_back(BB);
+ if (!BB->use_empty()) {
+ CGF.CurFn->insertBasicBlockAt(CGF.CurFn->end(), BB);
+ return;
+ }
delete BB;
}