#include "llvm/BasicBlock.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
return 0;
}
+LLVMContext &BasicBlock::getContext() const {
+ return getType()->getContext();
+}
+
// Explicit instantiation of SymbolTableListTraits since some of the methods
// are not in the public header file...
template class SymbolTableListTraits<Instruction, BasicBlock>;
-BasicBlock::BasicBlock(const std::string &Name, Function *NewParent,
+BasicBlock::BasicBlock(const Twine &Name, Function *NewParent,
BasicBlock *InsertBefore)
: Value(Type::LabelTy, Value::BasicBlockVal), Parent(0) {
PN->replaceAllUsesWith(PN->getOperand(0));
else
// We are left with an infinite loop with no entries: kill the PHI.
- PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+ PN->replaceAllUsesWith(getContext().getUndef(PN->getType()));
getInstList().pop_front(); // Remove the PHI node
}
/// cause a degenerate basic block to be formed, having a terminator inside of
/// the basic block).
///
-BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) {
+BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) {
assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!");
assert(I != InstList.end() &&
"Trying to get me to create degenerate basic block!");