Use nullptr instead of 0 (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 30 Jul 2022 17:35:48 +0000 (10:35 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 30 Jul 2022 17:35:48 +0000 (10:35 -0700)
Identified with modernize-use-nullptr.

bolt/lib/Passes/IdenticalCodeFolding.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
llvm/lib/Analysis/PHITransAddr.cpp

index 1ae213d..e6a92ec 100644 (file)
@@ -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;
 
index 8c171a8..07412b7 100644 (file)
@@ -5054,7 +5054,7 @@ void RewriteInstance::patchELFDynamic(ELFObjectFile<ELFT> *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<ELFT> *File) {
   using Elf_Dyn = typename ELFFile<ELFT>::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;
index 5b0fbca..9bd3934 100644 (file)
@@ -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",