mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
- Add new ctor to BasicBlock to allow insertion before any BB, not just at
the end of the function. llvm-svn: 3934
This commit is contained in:
parent
06076d8d3e
commit
989b743c33
@ -67,6 +67,26 @@ BasicBlock::BasicBlock(const std::string &name, Function *Parent)
|
||||
Parent->getBasicBlockList().push_back(this);
|
||||
}
|
||||
|
||||
/// BasicBlock ctor - If the InsertBefore parameter is specified, the basic
|
||||
/// block is automatically inserted right before the specified block.
|
||||
///
|
||||
BasicBlock::BasicBlock(const std::string &Name, BasicBlock *InsertBefore)
|
||||
: Value(Type::LabelTy, Value::BasicBlockVal, Name) {
|
||||
// Initialize the instlist...
|
||||
InstList.setItemParent(this);
|
||||
|
||||
// Make sure that we get added to a function
|
||||
LeakDetector::addGarbageObject(this);
|
||||
|
||||
if (InsertBefore) {
|
||||
assert(InsertBefore->getParent() &&
|
||||
"Cannot insert block before another block that is not embedded into"
|
||||
" a function yet!");
|
||||
InsertBefore->getParent()->getBasicBlockList().insert(InsertBefore, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BasicBlock::~BasicBlock() {
|
||||
dropAllReferences();
|
||||
InstList.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user