From 60db8d9b4e486b0070597ef5fac109c7b9d2398a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 30 Jul 2022 10:35:48 -0700 Subject: [PATCH] Use nullptr instead of 0 (NFC) Identified with modernize-use-nullptr. --- bolt/lib/Passes/IdenticalCodeFolding.cpp | 2 +- bolt/lib/Rewrite/RewriteInstance.cpp | 4 ++-- llvm/lib/Analysis/PHITransAddr.cpp | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bolt/lib/Passes/IdenticalCodeFolding.cpp b/bolt/lib/Passes/IdenticalCodeFolding.cpp index 1ae213d..e6a92ec 100644 --- a/bolt/lib/Passes/IdenticalCodeFolding.cpp +++ b/bolt/lib/Passes/IdenticalCodeFolding.cpp @@ -281,7 +281,7 @@ bool isIdenticalWith(const BinaryFunction &A, const BinaryFunction &B, // One of the identical blocks may have a trailing unconditional jump that // is ignored for CFG purposes. const MCInst *TrailingInstr = - (I != E ? &(*I) : (OtherI != OtherE ? &(*OtherI) : 0)); + (I != E ? &(*I) : (OtherI != OtherE ? &(*OtherI) : nullptr)); if (TrailingInstr && !BC.MIB->isUnconditionalBranch(*TrailingInstr)) return false; diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 8c171a8..07412b7 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -5054,7 +5054,7 @@ void RewriteInstance::patchELFDynamic(ELFObjectFile *File) { // Locate DYNAMIC by looking through program headers. uint64_t DynamicOffset = 0; - const Elf_Phdr *DynamicPhdr = 0; + const Elf_Phdr *DynamicPhdr = nullptr; for (const Elf_Phdr &Phdr : cantFail(Obj.program_headers())) { if (Phdr.p_type == ELF::PT_DYNAMIC) { DynamicOffset = Phdr.p_offset; @@ -5139,7 +5139,7 @@ Error RewriteInstance::readELFDynamic(ELFObjectFile *File) { using Elf_Dyn = typename ELFFile::Elf_Dyn; // Locate DYNAMIC by looking through program headers. - const Elf_Phdr *DynamicPhdr = 0; + const Elf_Phdr *DynamicPhdr = nullptr; for (const Elf_Phdr &Phdr : cantFail(Obj.program_headers())) { if (Phdr.p_type == ELF::PT_DYNAMIC) { DynamicPhdr = &Phdr; diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index 5b0fbca..9bd3934 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/lib/Analysis/PHITransAddr.cpp @@ -425,7 +425,8 @@ InsertPHITranslatedSubExpr(Value *InVal, BasicBlock *CurBB, // PHI translate the LHS. Value *OpVal = InsertPHITranslatedSubExpr(Inst->getOperand(0), CurBB, PredBB, DT, NewInsts); - if (OpVal == 0) return 0; + if (OpVal == nullptr) + return nullptr; BinaryOperator *Res = BinaryOperator::CreateAdd(OpVal, Inst->getOperand(1), InVal->getName()+".phi.trans.insert", -- 2.7.4