Appending a basic block to a function is a fairly common operation. The basic block list is private now, so pushing back is currently done by myFunction->insert(myFunction->getEnd(), bb);, which feels a bit redundant. This patch adds a push_back convenience function to llvm::Function to make appending basic blocks a bit easier again.
+ /// append \p BB to the end of the function + void push_back(BasicBlock *BB) { + return BasicBlocks.push_back(BB); + }
I've also gone through and migrated the usage in kaleidoscope, the getting started docs, and in clang where I saw it.
I'm open to leaving that part of the change off, but it makes it a little bit clearer what the intended goal is.
I was going back and forth a little regarding the naming. appendBasicBlock is clearest, push_back is most consistent though.