From a19ae77d2a9016428fee7cd5af03fd20ad6d4464 Mon Sep 17 00:00:00 2001 From: Vasileios Porpodas Date: Mon, 12 Dec 2022 14:57:47 -0800 Subject: [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 --- clang/lib/CodeGen/CodeGenFunction.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') 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; } -- cgit v1.1