ValueSymbolTable *BasicBlock::getValueSymbolTable() {
if (Function *F = getParent())
return &F->getValueSymbolTable();
- return 0;
+ return nullptr;
}
const DataLayout *BasicBlock::getDataLayout() const {
BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
BasicBlock *InsertBefore)
- : Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(0) {
+ : Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) {
// Make sure that we get added to a function
LeakDetector::addGarbageObject(this);
}
}
- assert(getParent() == 0 && "BasicBlock still linked into the program!");
+ assert(getParent() == nullptr && "BasicBlock still linked into the program!");
dropAllReferences();
InstList.clear();
}
TerminatorInst *BasicBlock::getTerminator() {
- if (InstList.empty()) return 0;
+ if (InstList.empty()) return nullptr;
return dyn_cast<TerminatorInst>(&InstList.back());
}
const TerminatorInst *BasicBlock::getTerminator() const {
- if (InstList.empty()) return 0;
+ if (InstList.empty()) return nullptr;
return dyn_cast<TerminatorInst>(&InstList.back());
}
/// return the block, otherwise return a null pointer.
BasicBlock *BasicBlock::getSinglePredecessor() {
pred_iterator PI = pred_begin(this), E = pred_end(this);
- if (PI == E) return 0; // No preds.
+ if (PI == E) return nullptr; // No preds.
BasicBlock *ThePred = *PI;
++PI;
- return (PI == E) ? ThePred : 0 /*multiple preds*/;
+ return (PI == E) ? ThePred : nullptr /*multiple preds*/;
}
/// getUniquePredecessor - If this basic block has a unique predecessor block,
/// a switch statement with multiple cases having the same destination).
BasicBlock *BasicBlock::getUniquePredecessor() {
pred_iterator PI = pred_begin(this), E = pred_end(this);
- if (PI == E) return 0; // No preds.
+ if (PI == E) return nullptr; // No preds.
BasicBlock *PredBB = *PI;
++PI;
for (;PI != E; ++PI) {
if (*PI != PredBB)
- return 0;
+ return nullptr;
// The same predecessor appears multiple times in the predecessor list.
// This is OK.
}
PN->removeIncomingValue(Pred, false);
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
- Value* PNV = 0;
+ Value* PNV = nullptr;
if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
if (PNV != PN) {
PN->replaceAllUsesWith(PNV);