Skip to content

Commit 817aff6

Browse files
[llvm] Use nullptr instead of 0 or NULL (NFC) (#165396)
Identified with modernize-use-nullptr.
1 parent 75ddf2a commit 817aff6

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3761,7 +3761,7 @@ class LLVM_ABI TargetLoweringBase {
37613761
/// register class is the largest legal super-reg register class of the
37623762
/// register class of the specified type. e.g. On x86, i8, i16, and i32's
37633763
/// representative class would be GR32.
3764-
const TargetRegisterClass *RepRegClassForVT[MVT::VALUETYPE_SIZE] = {0};
3764+
const TargetRegisterClass *RepRegClassForVT[MVT::VALUETYPE_SIZE] = {nullptr};
37653765

37663766
/// This indicates the "cost" of the "representative" register class for each
37673767
/// ValueType. The cost is used by the scheduler to approximate register

llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ llvm::Error GsymCreator::saveSegments(StringRef Path,
552552
createSegment(SegmentSize, FuncIdx);
553553
if (ExpectedGC) {
554554
GsymCreator *GC = ExpectedGC->get();
555-
if (GC == NULL)
555+
if (!GC)
556556
break; // We had not more functions to encode.
557557
// Don't collect any messages at all
558558
OutputAggregator Out(nullptr);

llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct PerfState {
5555
std::unique_ptr<raw_fd_ostream> Dumpstream;
5656

5757
// perf mmap marker
58-
void *MarkerAddr = NULL;
58+
void *MarkerAddr = nullptr;
5959
};
6060

6161
// prevent concurrent dumps from messing up the output file

llvm/lib/SandboxIR/Context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ Argument *Context::getOrCreateArgument(llvm::Argument *LLVMArg) {
443443
}
444444

445445
Constant *Context::getOrCreateConstant(llvm::Constant *LLVMC) {
446-
return cast<Constant>(getOrCreateValueInternal(LLVMC, 0));
446+
return cast<Constant>(getOrCreateValueInternal(LLVMC, nullptr));
447447
}
448448

449449
BasicBlock *Context::createBasicBlock(llvm::BasicBlock *LLVMBB) {

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ Register SPIRVGlobalRegistry::buildGlobalVariable(
745745
.addDef(ResVReg)
746746
.addUse(getSPIRVTypeID(BaseType))
747747
.addImm(static_cast<uint32_t>(Storage));
748-
if (Init != 0)
748+
if (Init)
749749
MIB.addUse(Init->getOperand(0).getReg());
750750
// ISel may introduce a new register on this step, so we need to add it to
751751
// DT and correct its type avoiding fails on the next stage.

llvm/lib/TargetParser/Host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family,
11791179
const unsigned *Features,
11801180
unsigned *Type,
11811181
unsigned *Subtype) {
1182-
const char *CPU = 0;
1182+
const char *CPU = nullptr;
11831183

11841184
switch (Family) {
11851185
case 4:

llvm/lib/Transforms/IPO/ExpandVariadics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ bool ExpandVariadics::runOnModule(Module &M) {
380380
if (CB->isIndirectCall()) {
381381
FunctionType *FTy = CB->getFunctionType();
382382
if (FTy->isVarArg())
383-
Changed |= expandCall(M, Builder, CB, FTy, 0);
383+
Changed |= expandCall(M, Builder, CB, FTy, /*NF=*/nullptr);
384384
}
385385
}
386386
}

llvm/unittests/ProfileData/InstrProfTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ TEST_P(MaybeSparseInstrProfTest, annotate_vp_data) {
914914
ASSERT_THAT(ValueData, SizeIs(0));
915915

916916
// Remove the MD_prof metadata
917-
Inst->setMetadata(LLVMContext::MD_prof, 0);
917+
Inst->setMetadata(LLVMContext::MD_prof, nullptr);
918918
// Annotate 5 records this time.
919919
annotateValueSite(*M, *Inst, R.get(), IPVK_IndirectCallTarget, 0, 5);
920920
ValueData = getValueProfDataFromInst(*Inst, IPVK_IndirectCallTarget, 5, T);
@@ -932,7 +932,7 @@ TEST_P(MaybeSparseInstrProfTest, annotate_vp_data) {
932932
ASSERT_EQ(2U, ValueData[4].Count);
933933

934934
// Remove the MD_prof metadata
935-
Inst->setMetadata(LLVMContext::MD_prof, 0);
935+
Inst->setMetadata(LLVMContext::MD_prof, nullptr);
936936
// Annotate with 4 records.
937937
InstrProfValueData VD0Sorted[] = {{1000, 6}, {2000, 5}, {3000, 4}, {4000, 3},
938938
{5000, 2}, {6000, 1}};

0 commit comments

Comments
 (0)