Skip to content

Commit

Permalink
[C++11] More 'nullptr' conversion. In some cases just using a boolean…
Browse files Browse the repository at this point in the history
… check instead of comparing to nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206252 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Apr 15, 2014
1 parent eb19b8f commit 0b6cb71
Show file tree
Hide file tree
Showing 73 changed files with 461 additions and 456 deletions.
12 changes: 6 additions & 6 deletions include/llvm/Bitcode/BitstreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class BitstreamReader {
i != e; ++i)
if (BlockInfoRecords[i].BlockID == BlockID)
return &BlockInfoRecords[i];
return 0;
return nullptr;
}

BlockInfo &getOrCreateBlockInfo(unsigned BlockID) {
Expand Down Expand Up @@ -200,9 +200,9 @@ class BitstreamCursor {


public:
BitstreamCursor() : BitStream(0), NextChar(0) {
}
BitstreamCursor(const BitstreamCursor &RHS) : BitStream(0), NextChar(0) {
BitstreamCursor() : BitStream(nullptr), NextChar(0) {}
BitstreamCursor(const BitstreamCursor &RHS)
: BitStream(nullptr), NextChar(0) {
operator=(RHS);
}

Expand Down Expand Up @@ -490,7 +490,7 @@ class BitstreamCursor {

/// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter
/// the block, and return true if the block has an error.
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0);
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = nullptr);

bool ReadBlockEnd() {
if (BlockScope.empty()) return true;
Expand Down Expand Up @@ -541,7 +541,7 @@ class BitstreamCursor {
void skipRecord(unsigned AbbrevID);

unsigned readRecord(unsigned AbbrevID, SmallVectorImpl<uint64_t> &Vals,
StringRef *Blob = 0);
StringRef *Blob = nullptr);

//===--------------------------------------------------------------------===//
// Abbrev Processing
Expand Down
8 changes: 4 additions & 4 deletions include/llvm/Bitcode/BitstreamWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class BitstreamWriter {
i != e; ++i)
if (BlockInfoRecords[i].BlockID == BlockID)
return &BlockInfoRecords[i];
return 0;
return nullptr;
}

void EnterSubblock(unsigned BlockID, unsigned CodeLen) {
Expand Down Expand Up @@ -347,7 +347,7 @@ class BitstreamWriter {
EmitAbbreviatedField(EltEnc, (unsigned char)BlobData[i]);

// Know that blob data is consumed for assertion below.
BlobData = 0;
BlobData = nullptr;
} else {
// Emit a vbr6 to indicate the number of elements present.
EmitVBR(static_cast<uint32_t>(Vals.size()-RecordIdx), 6);
Expand Down Expand Up @@ -378,7 +378,7 @@ class BitstreamWriter {
WriteByte((unsigned char)BlobData[i]);

// Know that blob data is consumed for assertion below.
BlobData = 0;
BlobData = nullptr;
} else {
for (unsigned e = Vals.size(); RecordIdx != e; ++RecordIdx) {
assert(isUInt<8>(Vals[RecordIdx]) &&
Expand All @@ -397,7 +397,7 @@ class BitstreamWriter {
}
}
assert(RecordIdx == Vals.size() && "Not all record operands emitted!");
assert(BlobData == 0 &&
assert(BlobData == nullptr &&
"Blob data specified for record that doesn't use it!");
}

Expand Down
4 changes: 2 additions & 2 deletions include/llvm/CodeGen/FunctionLoweringInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ class FunctionLoweringInfo {
/// register is a PHI destination and the PHI's LiveOutInfo is not valid.
const LiveOutInfo *GetLiveOutRegInfo(unsigned Reg) {
if (!LiveOutRegInfo.inBounds(Reg))
return NULL;
return nullptr;

const LiveOutInfo *LOI = &LiveOutRegInfo[Reg];
if (!LOI->IsValid)
return NULL;
return nullptr;

return LOI;
}
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/ResourcePriorityQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace llvm {
void updateNode(const SUnit *SU) override {}

void releaseState() override {
SUnits = 0;
SUnits = nullptr;
}

unsigned getLatency(unsigned NodeNum) const {
Expand Down
15 changes: 8 additions & 7 deletions include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class SelectionDAG {
Ops.push_back(Op2);
Ops.push_back(InGlue);
return getNode(ISD::CALLSEQ_END, DL, NodeTys, &Ops[0],
(unsigned)Ops.size() - (InGlue.getNode() == 0 ? 1 : 0));
(unsigned)Ops.size() - (InGlue.getNode()==nullptr ? 1 : 0));
}

/// getUNDEF - Return an UNDEF node. UNDEF does not have a useful SDLoc.
Expand Down Expand Up @@ -766,14 +766,15 @@ class SelectionDAG {
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
MachinePointerInfo PtrInfo, bool isVolatile,
bool isNonTemporal, bool isInvariant, unsigned Alignment,
const MDNode *TBAAInfo = 0, const MDNode *Ranges = 0);
const MDNode *TBAAInfo = nullptr,
const MDNode *Ranges = nullptr);
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
MachineMemOperand *MMO);
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
EVT MemVT, bool isVolatile,
bool isNonTemporal, unsigned Alignment,
const MDNode *TBAAInfo = 0);
const MDNode *TBAAInfo = nullptr);
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
SDValue Chain, SDValue Ptr, EVT MemVT,
MachineMemOperand *MMO);
Expand All @@ -784,8 +785,8 @@ class SelectionDAG {
SDValue Chain, SDValue Ptr, SDValue Offset,
MachinePointerInfo PtrInfo, EVT MemVT,
bool isVolatile, bool isNonTemporal, bool isInvariant,
unsigned Alignment, const MDNode *TBAAInfo = 0,
const MDNode *Ranges = 0);
unsigned Alignment, const MDNode *TBAAInfo = nullptr,
const MDNode *Ranges = nullptr);
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
EVT VT, SDLoc dl,
SDValue Chain, SDValue Ptr, SDValue Offset,
Expand All @@ -796,14 +797,14 @@ class SelectionDAG {
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
MachinePointerInfo PtrInfo, bool isVolatile,
bool isNonTemporal, unsigned Alignment,
const MDNode *TBAAInfo = 0);
const MDNode *TBAAInfo = nullptr);
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
MachineMemOperand *MMO);
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
MachinePointerInfo PtrInfo, EVT TVT,
bool isNonTemporal, bool isVolatile,
unsigned Alignment,
const MDNode *TBAAInfo = 0);
const MDNode *TBAAInfo = nullptr);
SDValue getTruncStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr,
EVT TVT, MachineMemOperand *MMO);
SDValue getIndexedStore(SDValue OrigStoe, SDLoc dl, SDValue Base,
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/DebugInfo/DWARFFormValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DWARFFormValue {

private:
struct ValueType {
ValueType() : data(NULL) {
ValueType() : data(nullptr) {
uval = 0;
}

Expand All @@ -60,7 +60,7 @@ class DWARFFormValue {
bool extractValue(DataExtractor data, uint32_t *offset_ptr,
const DWARFUnit *u);
bool isInlinedCStr() const {
return Value.data != NULL && Value.data == (const uint8_t*)Value.cstr;
return Value.data != nullptr && Value.data == (const uint8_t*)Value.cstr;
}

/// getAsFoo functions below return the extracted value as Foo if only
Expand Down
20 changes: 10 additions & 10 deletions include/llvm/ExecutionEngine/ExecutionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ExecutionEngine {
/// freeMachineCodeForFunction works.
static ExecutionEngine *create(Module *M,
bool ForceInterpreter = false,
std::string *ErrorStr = 0,
std::string *ErrorStr = nullptr,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
bool GVsWithCode = true);
Expand All @@ -193,8 +193,8 @@ class ExecutionEngine {
/// Clients should make sure to initialize targets prior to calling this
/// function.
static ExecutionEngine *createJIT(Module *M,
std::string *ErrorStr = 0,
JITMemoryManager *JMM = 0,
std::string *ErrorStr = nullptr,
JITMemoryManager *JMM = nullptr,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
bool GVsWithCode = true,
Expand Down Expand Up @@ -411,7 +411,7 @@ class ExecutionEngine {
}

// The JIT overrides a version that actually does this.
virtual void runJITOnFunction(Function *, MachineCodeInfo * = 0) { }
virtual void runJITOnFunction(Function *, MachineCodeInfo * = nullptr) { }

/// getGlobalValueAtAddress - Return the LLVM global value object that starts
/// at the specified address.
Expand Down Expand Up @@ -478,7 +478,7 @@ class ExecutionEngine {
}

/// Return the target machine (if available).
virtual TargetMachine *getTargetMachine() { return NULL; }
virtual TargetMachine *getTargetMachine() { return nullptr; }

/// DisableLazyCompilation - When lazy compilation is off (the default), the
/// JIT will eagerly compile every function reachable from the argument to
Expand Down Expand Up @@ -576,10 +576,10 @@ class EngineBuilder {
/// InitEngine - Does the common initialization of default options.
void InitEngine() {
WhichEngine = EngineKind::Either;
ErrorStr = NULL;
ErrorStr = nullptr;
OptLevel = CodeGenOpt::Default;
MCJMM = NULL;
JMM = NULL;
MCJMM = nullptr;
JMM = nullptr;
Options = TargetOptions();
AllocateGVsWithCode = false;
RelocModel = Reloc::Default;
Expand Down Expand Up @@ -610,7 +610,7 @@ class EngineBuilder {
/// the setJITMemoryManager() option.
EngineBuilder &setMCJITMemoryManager(RTDyldMemoryManager *mcjmm) {
MCJMM = mcjmm;
JMM = NULL;
JMM = nullptr;
return *this;
}

Expand All @@ -622,7 +622,7 @@ class EngineBuilder {
/// memory manager. This option defaults to NULL. This option overrides
/// setMCJITMemoryManager() as well.
EngineBuilder &setJITMemoryManager(JITMemoryManager *jmm) {
MCJMM = NULL;
MCJMM = nullptr;
JMM = jmm;
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/ExecutionEngine/RTDyldMemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class RTDyldMemoryManager {
/// operations needed to reliably use the memory are also performed.
///
/// Returns true if an error occurred, false otherwise.
virtual bool finalizeMemory(std::string *ErrMsg = 0) = 0;
virtual bool finalizeMemory(std::string *ErrMsg = nullptr) = 0;
};

// Create wrappers for C Binding types (see CBindingWrapping.h).
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/IR/LegacyPassNameParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PassNameParser : public PassRegistrationListener,
if (findOption(P->getPassArgument()) != getNumOptions()) {
errs() << "Two passes with the same argument (-"
<< P->getPassArgument() << ") attempted to be registered!\n";
llvm_unreachable(0);
llvm_unreachable(nullptr);
}
addLiteralOption(P->getPassArgument(), P, P->getPassName());
}
Expand Down
6 changes: 3 additions & 3 deletions include/llvm/LTO/LTOModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct LTOModule {
const char *getSymbolName(uint32_t index) {
if (index < _symbols.size())
return _symbols[index].name;
return NULL;
return nullptr;
}

/// getDependentLibraryCount - Get the number of dependent libraries
Expand All @@ -141,7 +141,7 @@ struct LTOModule {
const char *getDependentLibrary(uint32_t index) {
if (index < _deplibs.size())
return _deplibs[index];
return NULL;
return nullptr;
}

/// getLinkerOptCount - Get the number of linker options
Expand All @@ -153,7 +153,7 @@ struct LTOModule {
const char *getLinkerOpt(uint32_t index) {
if (index < _linkeropts.size())
return _linkeropts[index];
return NULL;
return nullptr;
}

/// getLLVVMModule - Return the Module.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/MC/MCParser/AsmLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AsmLexer : public MCAsmLexer {
AsmLexer(const MCAsmInfo &MAI);
~AsmLexer();

void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL);
void setBuffer(const MemoryBuffer *buf, const char *ptr = nullptr);

StringRef LexUntilEndOfStatement() override;
StringRef LexUntilEndOfLine();
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/MC/MCParser/MCAsmParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MCAsmParserSemaCallback {
unsigned Length, Size, Type;

void clear() {
OpDecl = 0;
OpDecl = nullptr;
IsVarDecl = false;
Length = 1;
Size = 0;
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/MC/MCTargetAsmParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct ParseInstructionInfo {

SmallVectorImpl<AsmRewrite> *AsmRewrites;

ParseInstructionInfo() : AsmRewrites(0) {}
ParseInstructionInfo() : AsmRewrites(nullptr) {}
ParseInstructionInfo(SmallVectorImpl<AsmRewrite> *rewrites)
: AsmRewrites(rewrites) {}

Expand Down Expand Up @@ -179,7 +179,7 @@ class MCTargetAsmParser : public MCAsmParserExtension {
virtual const MCExpr *applyModifierToExpr(const MCExpr *E,
MCSymbolRefExpr::VariantKind,
MCContext &Ctx) {
return 0;
return nullptr;
}

virtual void onLabelParsed(MCSymbol *Symbol) { };
Expand Down
6 changes: 3 additions & 3 deletions include/llvm/Object/Archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ class Archive : public Binary {
bool FullPath = false) const;

error_code getAsBinary(OwningPtr<Binary> &Result,
LLVMContext *Context = 0) const;
LLVMContext *Context = nullptr) const;
error_code getAsBinary(std::unique_ptr<Binary> &Result,
LLVMContext *Context = 0) const;
LLVMContext *Context = nullptr) const;
};

class child_iterator {
Child child;
public:
child_iterator() : child(Child(0, 0)) {}
child_iterator() : child(Child(nullptr, nullptr)) {}
child_iterator(const Child &c) : child(c) {}
const Child* operator->() const {
return &child;
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/Object/COFF.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ class COFFObjectFile : public ObjectFile {
// The iterator for the import directory table.
class ImportDirectoryEntryRef {
public:
ImportDirectoryEntryRef() : OwningObject(0) {}
ImportDirectoryEntryRef() : OwningObject(nullptr) {}
ImportDirectoryEntryRef(const import_directory_table_entry *Table, uint32_t I,
const COFFObjectFile *Owner)
: ImportTable(Table), Index(I), OwningObject(Owner) {}
Expand All @@ -488,7 +488,7 @@ class ImportDirectoryEntryRef {
// The iterator for the export directory table entry.
class ExportDirectoryEntryRef {
public:
ExportDirectoryEntryRef() : OwningObject(0) {}
ExportDirectoryEntryRef() : OwningObject(nullptr) {}
ExportDirectoryEntryRef(const export_directory_table_entry *Table, uint32_t I,
const COFFObjectFile *Owner)
: ExportTable(Table), Index(I), OwningObject(Owner) {}
Expand Down
Loading

0 comments on commit 0b6cb71

Please sign in to comment.