mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-22 10:24:26 +00:00
[C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -51,19 +51,19 @@ AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
|
||||
|
||||
static const Module *getModuleFromVal(const Value *V) {
|
||||
if (const Argument *MA = dyn_cast<Argument>(V))
|
||||
return MA->getParent() ? MA->getParent()->getParent() : 0;
|
||||
return MA->getParent() ? MA->getParent()->getParent() : nullptr;
|
||||
|
||||
if (const BasicBlock *BB = dyn_cast<BasicBlock>(V))
|
||||
return BB->getParent() ? BB->getParent()->getParent() : 0;
|
||||
return BB->getParent() ? BB->getParent()->getParent() : nullptr;
|
||||
|
||||
if (const Instruction *I = dyn_cast<Instruction>(V)) {
|
||||
const Function *M = I->getParent() ? I->getParent()->getParent() : 0;
|
||||
return M ? M->getParent() : 0;
|
||||
const Function *M = I->getParent() ? I->getParent()->getParent() : nullptr;
|
||||
return M ? M->getParent() : nullptr;
|
||||
}
|
||||
|
||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
|
||||
return GV->getParent();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void PrintCallingConv(unsigned cc, raw_ostream &Out) {
|
||||
@ -421,10 +421,10 @@ static SlotTracker *createSlotTracker(const Value *V) {
|
||||
if (!MD->isFunctionLocal())
|
||||
return new SlotTracker(MD->getFunction());
|
||||
|
||||
return new SlotTracker((Function *)0);
|
||||
return new SlotTracker((Function *)nullptr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -436,21 +436,21 @@ static SlotTracker *createSlotTracker(const Value *V) {
|
||||
// Module level constructor. Causes the contents of the Module (sans functions)
|
||||
// to be added to the slot table.
|
||||
SlotTracker::SlotTracker(const Module *M)
|
||||
: TheModule(M), TheFunction(0), FunctionProcessed(false),
|
||||
: TheModule(M), TheFunction(nullptr), FunctionProcessed(false),
|
||||
mNext(0), fNext(0), mdnNext(0), asNext(0) {
|
||||
}
|
||||
|
||||
// Function level constructor. Causes the contents of the Module and the one
|
||||
// function provided to be added to the slot table.
|
||||
SlotTracker::SlotTracker(const Function *F)
|
||||
: TheModule(F ? F->getParent() : 0), TheFunction(F), FunctionProcessed(false),
|
||||
mNext(0), fNext(0), mdnNext(0), asNext(0) {
|
||||
: TheModule(F ? F->getParent() : nullptr), TheFunction(F),
|
||||
FunctionProcessed(false), mNext(0), fNext(0), mdnNext(0), asNext(0) {
|
||||
}
|
||||
|
||||
inline void SlotTracker::initialize() {
|
||||
if (TheModule) {
|
||||
processModule();
|
||||
TheModule = 0; ///< Prevent re-processing next time we're called.
|
||||
TheModule = nullptr; ///< Prevent re-processing next time we're called.
|
||||
}
|
||||
|
||||
if (TheFunction && !FunctionProcessed)
|
||||
@ -560,7 +560,7 @@ void SlotTracker::processFunction() {
|
||||
void SlotTracker::purgeFunction() {
|
||||
ST_DEBUG("begin purgeFunction!\n");
|
||||
fMap.clear(); // Simply discard the function level map
|
||||
TheFunction = 0;
|
||||
TheFunction = nullptr;
|
||||
FunctionProcessed = false;
|
||||
ST_DEBUG("end purgeFunction!\n");
|
||||
}
|
||||
@ -1048,7 +1048,7 @@ static void WriteMDNodeBodyInternal(raw_ostream &Out, const MDNode *Node,
|
||||
Out << "!{";
|
||||
for (unsigned mi = 0, me = Node->getNumOperands(); mi != me; ++mi) {
|
||||
const Value *V = Node->getOperand(mi);
|
||||
if (V == 0)
|
||||
if (!V)
|
||||
Out << "null";
|
||||
else {
|
||||
TypePrinter->print(V->getType(), Out);
|
||||
@ -1160,7 +1160,7 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
|
||||
Slot = Machine->getLocalSlot(V);
|
||||
}
|
||||
delete Machine;
|
||||
Machine = 0;
|
||||
Machine = nullptr;
|
||||
} else {
|
||||
Slot = -1;
|
||||
}
|
||||
@ -1194,7 +1194,7 @@ AssemblyWriter::AssemblyWriter(formatted_raw_ostream &o, const Module *M,
|
||||
AssemblyWriter::~AssemblyWriter() { }
|
||||
|
||||
void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) {
|
||||
if (Operand == 0) {
|
||||
if (!Operand) {
|
||||
Out << "<null operand!>";
|
||||
return;
|
||||
}
|
||||
@ -1259,7 +1259,7 @@ void AssemblyWriter::writeAtomicCmpXchg(AtomicOrdering SuccessOrdering,
|
||||
|
||||
void AssemblyWriter::writeParamOperand(const Value *Operand,
|
||||
AttributeSet Attrs, unsigned Idx) {
|
||||
if (Operand == 0) {
|
||||
if (!Operand) {
|
||||
Out << "<null operand!>";
|
||||
return;
|
||||
}
|
||||
@ -1502,7 +1502,7 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
|
||||
|
||||
const Constant *Aliasee = GA->getAliasee();
|
||||
|
||||
if (Aliasee == 0) {
|
||||
if (!Aliasee) {
|
||||
TypePrinter.print(GA->getType(), Out);
|
||||
Out << " <<NULL ALIASEE>>";
|
||||
} else {
|
||||
@ -1707,7 +1707,7 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
|
||||
Out << "<badref>";
|
||||
}
|
||||
|
||||
if (BB->getParent() == 0) {
|
||||
if (!BB->getParent()) {
|
||||
Out.PadToColumn(50);
|
||||
Out << "; Error: Block without parent!";
|
||||
} else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block?
|
||||
@ -1804,7 +1804,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||
writeAtomicRMWOperation(Out, RMWI->getOperation());
|
||||
|
||||
// Print out the type of the operands...
|
||||
const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0;
|
||||
const Value *Operand = I.getNumOperands() ? I.getOperand(0) : nullptr;
|
||||
|
||||
// Special case conditional branches to swizzle the condition out to the front
|
||||
if (isa<BranchInst>(I) && cast<BranchInst>(I).isConditional()) {
|
||||
@ -2155,7 +2155,7 @@ void NamedMDNode::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
|
||||
}
|
||||
|
||||
void Type::print(raw_ostream &OS) const {
|
||||
if (this == 0) {
|
||||
if (!this) {
|
||||
OS << "<null Type>";
|
||||
return;
|
||||
}
|
||||
@ -2220,7 +2220,7 @@ void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) cons
|
||||
if (!PrintType &&
|
||||
((!isa<Constant>(this) && !isa<MDNode>(this)) ||
|
||||
hasName() || isa<GlobalValue>(this))) {
|
||||
WriteAsOperandInternal(O, this, 0, 0, M);
|
||||
WriteAsOperandInternal(O, this, nullptr, nullptr, M);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2235,7 +2235,7 @@ void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) cons
|
||||
O << ' ';
|
||||
}
|
||||
|
||||
WriteAsOperandInternal(O, this, &TypePrinter, 0, M);
|
||||
WriteAsOperandInternal(O, this, &TypePrinter, nullptr, M);
|
||||
}
|
||||
|
||||
// Value::printCustom - subclasses should override this to implement printing.
|
||||
@ -2250,7 +2250,7 @@ void Value::dump() const { print(dbgs()); dbgs() << '\n'; }
|
||||
void Type::dump() const { print(dbgs()); }
|
||||
|
||||
// Module::dump() - Allow printing of Modules from the debugger.
|
||||
void Module::dump() const { print(dbgs(), 0); }
|
||||
void Module::dump() const { print(dbgs(), nullptr); }
|
||||
|
||||
// NamedMDNode::dump() - Allow printing of NamedMDNodes from the debugger.
|
||||
void NamedMDNode::dump() const { print(dbgs(), 0); }
|
||||
void NamedMDNode::dump() const { print(dbgs(), nullptr); }
|
||||
|
Reference in New Issue
Block a user