[llvm] r258831 - Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 10:48:37 PST 2016


Author: eugenezelenko
Date: Tue Jan 26 12:48:36 2016
New Revision: 258831

URL: http://llvm.org/viewvc/llvm-project?rev=258831&view=rev
Log:
Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.

Differential revision: reviews.llvm.org/D16568

Modified:
    llvm/trunk/include/llvm/ADT/ArrayRef.h
    llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
    llvm/trunk/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
    llvm/trunk/include/llvm/ProfileData/InstrProf.h
    llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
    llvm/trunk/include/llvm/Support/AlignOf.h
    llvm/trunk/include/llvm/Support/ErrorOr.h
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/ProfileData/InstrProf.cpp
    llvm/trunk/lib/Support/Unix/Memory.inc
    llvm/trunk/lib/Target/X86/X86ISelLowering.h
    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    llvm/trunk/lib/Transforms/Utils/AddDiscriminators.cpp
    llvm/trunk/lib/Transforms/Utils/SanitizerStats.cpp
    llvm/trunk/tools/sanstats/sanstats.cpp
    llvm/trunk/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
    llvm/trunk/unittests/IR/VerifierTest.cpp
    llvm/trunk/unittests/ProfileData/InstrProfTest.cpp
    llvm/trunk/unittests/Support/AlignOfTest.cpp
    llvm/trunk/utils/TableGen/DFAPacketizerEmitter.cpp

Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h Tue Jan 26 12:48:36 2016
@@ -16,7 +16,6 @@
 #include <vector>
 
 namespace llvm {
-
   /// ArrayRef - Represent a constant reference to an array (0 or more elements
   /// consecutively in memory), i.e. a start pointer and a length.  It allows
   /// various APIs to take consecutive elements easily and conveniently.
@@ -92,19 +91,20 @@ namespace llvm {
     /// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
     /// ensure that only ArrayRefs of pointers can be converted.
     template <typename U>
-    ArrayRef(const ArrayRef<U *> &A,
-             typename std::enable_if<
-                 std::is_convertible<U *const *, T const *>::value>::type* = 0)
+    ArrayRef(
+        const ArrayRef<U *> &A,
+        typename std::enable_if<
+           std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
       : Data(A.data()), Length(A.size()) {}
 
     /// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is
     /// templated in order to avoid instantiating SmallVectorTemplateCommon<T>
     /// whenever we copy-construct an ArrayRef.
     template<typename U, typename DummyT>
-    /*implicit*/ ArrayRef(const SmallVectorTemplateCommon<U*, DummyT> &Vec,
-                          typename std::enable_if<
-                              std::is_convertible<U *const *,
-                                                  T const *>::value>::type* = 0)
+    /*implicit*/ ArrayRef(
+      const SmallVectorTemplateCommon<U *, DummyT> &Vec,
+      typename std::enable_if<
+          std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
       : Data(Vec.data()), Length(Vec.size()) {
     }
 
@@ -379,6 +379,6 @@ namespace llvm {
   template <typename T> hash_code hash_value(ArrayRef<T> S) {
     return hash_combine_range(S.begin(), S.end());
   }
-}
+} // end namespace llvm
 
-#endif
+#endif // LLVM_ADT_ARRAYREF_H

Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Tue Jan 26 12:48:36 2016
@@ -66,7 +66,6 @@ namespace llvm {
 
     bool isPoisoned() const { return (reinterpret_cast<intptr_t>(mi) & 0x1) == 0x1; }
 #endif // EXPENSIVE_CHECKS
-
   };
 
   template <>
@@ -308,7 +307,6 @@ namespace llvm {
     SlotIndex getPrevIndex() const {
       return SlotIndex(&*--listEntry()->getIterator(), getSlot());
     }
-
   };
 
   template <> struct isPodLike<SlotIndex> { static const bool value = true; };
@@ -382,7 +380,7 @@ namespace llvm {
       initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
     }
 
-    ~SlotIndexes() {
+    ~SlotIndexes() override {
       // The indexList's nodes are all allocated in the BumpPtrAllocator.
       indexList.clearAndLeakNodesUnsafely();
     }
@@ -709,15 +707,13 @@ namespace llvm {
       indexList.erase(entry);
 #endif
     }
-
   };
 
-
   // Specialize IntervalMapInfo for half-open slot index intervals.
   template <>
   struct IntervalMapInfo<SlotIndex> : IntervalMapHalfOpenInfo<SlotIndex> {
   };
 
-}
+} // end namespace llvm
 
 #endif // LLVM_CODEGEN_SLOTINDEXES_H

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h Tue Jan 26 12:48:36 2016
@@ -56,13 +56,14 @@ public:
   }
 
 private:
-  virtual TypeIndex writeRecord(llvm::StringRef Data) override;
+  TypeIndex writeRecord(llvm::StringRef Data) override;
 
 private:
   std::vector<std::unique_ptr<Record>> Records;
   std::unordered_map<llvm::StringRef, TypeIndex, RecordHash> HashedRecords;
 };
-}
-}
 
-#endif
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_MEMORYTYPETABLEBUILDER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h Tue Jan 26 12:48:36 2016
@@ -57,7 +57,7 @@ public:
       return *this;
     }
 
-    ~RCMemoryManager() {
+    ~RCMemoryManager() override {
       Client.destroyRemoteAllocator(Id);
       DEBUG(dbgs() << "Destroyed remote allocator " << Id << "\n");
     }
@@ -355,7 +355,9 @@ public:
                            ResourceIdMgr::ResourceId Id)
         : Remote(Remote), Id(Id) {}
 
-    ~RCIndirectStubsManager() { Remote.destroyIndirectStubsManager(Id); }
+    ~RCIndirectStubsManager() override {
+      Remote.destroyIndirectStubsManager(Id);
+    }
 
     std::error_code createStub(StringRef StubName, TargetAddress StubAddr,
                                JITSymbolFlags StubFlags) override {
@@ -479,7 +481,7 @@ public:
     }
 
   private:
-    void grow() {
+    void grow() override {
       TargetAddress BlockAddr = 0;
       uint32_t NumTrampolines = 0;
       auto EC = Remote.emitTrampolineBlock(BlockAddr, NumTrampolines);
@@ -797,4 +799,4 @@ private:
 
 #undef DEBUG_TYPE
 
-#endif
+#endif // LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H

Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Tue Jan 26 12:48:36 2016
@@ -1,4 +1,4 @@
-//=-- InstrProf.h - Instrumented profiling format support ---------*- C++ -*-=//
+//===-- InstrProf.h - Instrumented profiling format support -----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -13,8 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_PROFILEDATA_INSTRPROF_H_
-#define LLVM_PROFILEDATA_INSTRPROF_H_
+#ifndef LLVM_PROFILEDATA_INSTRPROF_H
+#define LLVM_PROFILEDATA_INSTRPROF_H
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -413,10 +413,10 @@ struct InstrProfRecord {
   /// Return the array of profiled values at \p Site.
   inline std::unique_ptr<InstrProfValueData[]>
   getValueForSite(uint32_t ValueKind, uint32_t Site,
-                  uint64_t (*ValueMapper)(uint32_t, uint64_t) = 0) const;
+                  uint64_t (*ValueMapper)(uint32_t, uint64_t) = nullptr) const;
   inline void
   getValueForSite(InstrProfValueData Dest[], uint32_t ValueKind, uint32_t Site,
-                  uint64_t (*ValueMapper)(uint32_t, uint64_t) = 0) const;
+                  uint64_t (*ValueMapper)(uint32_t, uint64_t) = nullptr) const;
   /// Reserve space for NumValueSites sites.
   inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
   /// Add ValueData for ValueKind at value Site.
@@ -737,7 +737,7 @@ struct Header {
 #include "llvm/ProfileData/InstrProfData.inc"
 };
 
-}  // end namespace RawInstrProf
+} // end namespace RawInstrProf
 
 } // end namespace llvm
 
@@ -746,4 +746,4 @@ template <>
 struct is_error_code_enum<llvm::instrprof_error> : std::true_type {};
 }
 
-#endif // LLVM_PROFILEDATA_INSTRPROF_H_
+#endif // LLVM_PROFILEDATA_INSTRPROF_H

Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Tue Jan 26 12:48:36 2016
@@ -554,18 +554,18 @@ int initializeValueProfRuntimeRecord(Val
   for (I = 0; I <= IPVK_Last; I++) {
     uint16_t N = NumValueSites[I];
     if (!N) {
-      RuntimeRecord->SiteCountArray[I] = 0;
+      RuntimeRecord->SiteCountArray[I] = nullptr;
       continue;
     }
     NumValueKinds++;
     RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
     if (!RuntimeRecord->SiteCountArray[I])
       return 1;
-    RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL;
+    RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : nullptr;
     for (J = 0; J < N; J++) {
       /* Compute value count for each site. */
       uint32_t C = 0;
-      ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL;
+      ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : nullptr;
       while (Site) {
         C++;
         Site = Site->Next;
@@ -606,7 +606,7 @@ uint32_t getNumValueDataForSiteRT(const
 uint32_t getNumValueDataRT(const void *R, uint32_t VK) {
   unsigned I, S = 0;
   const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
-  if (Record->SiteCountArray[VK] == 0)
+  if (Record->SiteCountArray[VK] == nullptr)
     return 0;
   for (I = 0; I < Record->NumValueSites[VK]; I++)
     S += Record->SiteCountArray[VK][I];
@@ -631,12 +631,12 @@ ValueProfData *allocValueProfDataRT(size
   return (ValueProfData *)calloc(TotalSizeInBytes, 1);
 }
 
-static ValueProfRecordClosure RTRecordClosure = {0,
+static ValueProfRecordClosure RTRecordClosure = {nullptr,
                                                  getNumValueKindsRT,
                                                  getNumValueSitesRT,
                                                  getNumValueDataRT,
                                                  getNumValueDataForSiteRT,
-                                                 0,
+                                                 nullptr,
                                                  getValueForSiteRT,
                                                  allocValueProfDataRT};
 
@@ -663,17 +663,15 @@ serializeValueProfDataFromRT(const Value
   return serializeValueProfDataFrom(&RTRecordClosure, DstData);
 }
 
-
 #undef INSTR_PROF_COMMON_API_IMPL
 #endif /* INSTR_PROF_COMMON_API_IMPL */
 
 /*============================================================================*/
 
-
 #ifndef INSTR_PROF_DATA_DEFINED
 
-#ifndef INSTR_PROF_DATA_INC_
-#define INSTR_PROF_DATA_INC_
+#ifndef INSTR_PROF_DATA_INC
+#define INSTR_PROF_DATA_INC
 
 /* Helper macros.  */
 #define INSTR_PROF_SIMPLE_QUOTE(x) #x
@@ -760,7 +758,7 @@ typedef struct ValueProfNode {
   struct ValueProfNode *Next;
 } ValueProfNode;
 
-#endif /* INSTR_PROF_DATA_INC_ */
+#endif /* INSTR_PROF_DATA_INC */
 
 #else
 #undef INSTR_PROF_DATA_DEFINED

Modified: llvm/trunk/include/llvm/Support/AlignOf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/AlignOf.h (original)
+++ llvm/trunk/include/llvm/Support/AlignOf.h Tue Jan 26 12:48:36 2016
@@ -38,7 +38,7 @@ struct AlignmentCalcImpl {
 #endif
   T t;
 private:
-  AlignmentCalcImpl() {} // Never instantiate.
+  AlignmentCalcImpl() = delete;
 };
 
 // Abstract base class helper, this will have the minimal alignment and size
@@ -55,7 +55,7 @@ struct AlignmentCalcImplBase {
 // of type T.
 template <typename T>
 struct AlignmentCalcImpl<T, true> : AlignmentCalcImplBase, T {
-  virtual ~AlignmentCalcImpl() = 0;
+  ~AlignmentCalcImpl() override = 0;
 };
 
 } // End detail namespace.
@@ -223,7 +223,7 @@ template <typename T1,
 class AlignerImpl {
   T1 t1; T2 t2; T3 t3; T4 t4; T5 t5; T6 t6; T7 t7; T8 t8; T9 t9; T10 t10;
 
-  AlignerImpl(); // Never defined or instantiated.
+  AlignerImpl() = delete;
 };
 
 template <typename T1,
@@ -255,4 +255,5 @@ struct AlignedCharArrayUnion : llvm::Ali
                                      T6, T7, T8, T9, T10>)> {
 };
 } // end namespace llvm
-#endif
+
+#endif // LLVM_SUPPORT_ALIGNOF_H

Modified: llvm/trunk/include/llvm/Support/ErrorOr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorOr.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ErrorOr.h (original)
+++ llvm/trunk/include/llvm/Support/ErrorOr.h Tue Jan 26 12:48:36 2016
@@ -98,7 +98,7 @@ public:
   ErrorOr(E ErrorCode,
           typename std::enable_if<std::is_error_code_enum<E>::value ||
                                       std::is_error_condition_enum<E>::value,
-                                  void *>::type = 0)
+                                  void *>::type = nullptr)
       : HasError(true) {
     new (getErrorStorage()) std::error_code(make_error_code(ErrorCode));
   }
@@ -278,7 +278,6 @@ private:
     return const_cast<ErrorOr<T> *>(this)->getErrorStorage();
   }
 
-
   union {
     AlignedCharArrayUnion<storage_type> TStorage;
     AlignedCharArrayUnion<std::error_code> ErrorStorage;
@@ -295,4 +294,4 @@ operator==(const ErrorOr<T> &Err, E Code
 }
 } // end namespace llvm
 
-#endif
+#endif // LLVM_SUPPORT_ERROROR_H

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 26 12:48:36 2016
@@ -35,6 +35,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 #include <deque>
+
 using namespace llvm;
 
 namespace {
@@ -497,7 +498,7 @@ private:
   std::error_code initStreamFromBuffer();
   std::error_code initLazyStream(std::unique_ptr<DataStreamer> Streamer);
 };
-} // namespace
+} // end anonymous namespace
 
 BitcodeDiagnosticInfo::BitcodeDiagnosticInfo(std::error_code EC,
                                              DiagnosticSeverity Severity,
@@ -872,7 +873,7 @@ public:
   /// Provide fast operand accessors
   DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
 };
-}
+} // end anonymous namespace
 
 // FIXME: can we inherit this from ConstantExpr?
 template <>
@@ -880,7 +881,7 @@ struct OperandTraits<ConstantPlaceHolder
   public FixedNumOperandTraits<ConstantPlaceHolder, 1> {
 };
 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantPlaceHolder, Value)
-}
+} // end namespace llvm
 
 void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx) {
   if (Idx == size()) {
@@ -908,11 +909,8 @@ void BitcodeReaderValueList::assignValue
     OldV->replaceAllUsesWith(V);
     delete PrevVal;
   }
-
-  return;
 }
 
-
 Constant *BitcodeReaderValueList::getConstantFwdRef(unsigned Idx,
                                                     Type *Ty) {
   if (Idx >= size())
@@ -1129,7 +1127,6 @@ StructType *BitcodeReader::createIdentif
   return Ret;
 }
 
-
 //===----------------------------------------------------------------------===//
 //  Functions for parsing blocks from the bitcode file
 //===----------------------------------------------------------------------===//
@@ -2178,7 +2175,7 @@ std::error_code BitcodeReader::parseMeta
               getMDOrNull(Record[9]), getMDOrNull(Record[10]),
               getMDOrNull(Record[11]), getMDOrNull(Record[12]),
               getMDOrNull(Record[13]),
-              Record.size() <= 15 ? 0 : getMDOrNull(Record[15]),
+              Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
               Record.size() <= 14 ? 0 : Record[14]),
           NextMetadataNo++);
       break;
@@ -2701,7 +2698,6 @@ std::error_code BitcodeReader::parseCons
       }
       break;
     }
-
     case bitc::CST_CODE_CE_BINOP: {  // CE_BINOP: [opcode, opval, opval]
       if (Record.size() < 3)
         return error("Invalid record");
@@ -3375,7 +3371,6 @@ std::error_code BitcodeReader::parseModu
       break;
     }
 
-
     // Read a record.
     auto BitCode = Stream.readRecord(Entry.ID, Record);
     switch (BitCode) {
@@ -5816,7 +5811,7 @@ class BitcodeErrorCategoryType : public
     llvm_unreachable("Unknown error type!");
   }
 };
-}
+} // end anonymous namespace
 
 static ManagedStatic<BitcodeErrorCategoryType> ErrorCategory;
 

Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Tue Jan 26 12:48:36 2016
@@ -65,7 +65,7 @@ class InstrProfErrorCategoryType : publi
     llvm_unreachable("A value of instrprof_error has no message.");
   }
 };
-}
+} // end anonymous namespace
 
 static ManagedStatic<InstrProfErrorCategoryType> ErrorCategory;
 
@@ -443,12 +443,12 @@ ValueProfData *allocValueProfDataInstrPr
 }
 
 static ValueProfRecordClosure InstrProfRecordClosure = {
-    0,
+    nullptr,
     getNumValueKindsInstrProf,
     getNumValueSitesInstrProf,
     getNumValueDataInstrProf,
     getNumValueDataForSiteInstrProf,
-    0,
+    nullptr,
     getValueForSiteInstrProf,
     allocValueProfDataInstrProf};
 
@@ -638,7 +638,6 @@ void ProfileSummary::computeDetailedSumm
     ProfileSummaryEntry PSE = {Cutoff, Count, BlocksSeen};
     DetailedSummary.push_back(PSE);
   }
-  return;
 }
 
-}
+} // end namespace llvm

Modified: llvm/trunk/lib/Support/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Memory.inc?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Memory.inc (original)
+++ llvm/trunk/lib/Support/Unix/Memory.inc Tue Jan 26 12:48:36 2016
@@ -73,7 +73,7 @@ int getPosixProtectionFlags(unsigned Fla
   return PROT_NONE;
 }
 
-} // namespace
+} // anonymous namespace
 
 namespace llvm {
 namespace sys {
@@ -265,7 +265,7 @@ bool Memory::setWritable (MemoryBlock &M
 }
 
 bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
-  if (M.Address == 0 || M.Size == 0) return false;
+  if (M.Address == nullptr || M.Size == 0) return false;
   Memory::InvalidateInstructionCache(M.Address, M.Size);
 #if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
   kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Jan 26 12:48:36 2016
@@ -556,7 +556,7 @@ namespace llvm {
       // have memop! In fact, starting from ATOMADD64_DAG all opcodes will be
       // thought as target memory ops!
     };
-  }
+  } // end namespace X86ISD
 
   /// Define some predicates that are used for node matching.
   namespace X86 {
@@ -608,13 +608,12 @@ namespace llvm {
     bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
                                       bool hasSymbolicDisplacement = true);
 
-
     /// Determines whether the callee is required to pop its
     /// own arguments. Callee pop is necessary to support tail calls.
     bool isCalleePop(CallingConv::ID CallingConv,
                      bool is64Bit, bool IsVarArg, bool GuaranteeTCO);
 
-  }
+  } // end namespace X86
 
   //===--------------------------------------------------------------------===//
   //  X86 Implementation of the TargetLowering interface
@@ -685,9 +684,9 @@ namespace llvm {
     /// and types must exactly match those of the original return values of
     /// the node), or leaves Results empty, which indicates that the node is not
     /// to be custom lowered after all.
-    virtual void LowerOperationWrapper(SDNode *N,
-                                       SmallVectorImpl<SDValue> &Results,
-                                       SelectionDAG &DAG) const override;
+    void LowerOperationWrapper(SDNode *N,
+                               SmallVectorImpl<SDValue> &Results,
+                               SelectionDAG &DAG) const override;
 
     /// Replace the results of node with an illegal result
     /// type with new values built out of custom code.
@@ -695,7 +694,6 @@ namespace llvm {
     void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
                             SelectionDAG &DAG) const override;
 
-
     SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
 
     /// Return true if the target has native support for
@@ -1180,7 +1178,7 @@ namespace llvm {
   namespace X86 {
     FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
                              const TargetLibraryInfo *libInfo);
-  }
-}
+  } // end namespace X86
+} // end namespace llvm
 
-#endif    // X86ISELLOWERING_H
+#endif // LLVM_LIB_TARGET_X86_X86ISELLOWERING_H

Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Tue Jan 26 12:48:36 2016
@@ -257,7 +257,7 @@ public:
 
     if (CreateGlobalVar)
       FuncNameVar = createPGOFuncNameVar(F, FuncName);
-  };
+  }
 };
 
 // Compute Hash value for the CFG: the lower 32 bits are CRC32 of the index
@@ -690,7 +690,7 @@ void PGOUseFunc::setBranchWeights() {
       const PGOUseEdge *E = BBCountInfo.OutEdges[s];
       const BasicBlock *SrcBB = E->SrcBB;
       const BasicBlock *DestBB = E->DestBB;
-      if (DestBB == 0)
+      if (DestBB == nullptr)
         continue;
       unsigned SuccNum = GetSuccessorNumber(SrcBB, DestBB);
       uint64_t EdgeCount = E->CountValue;

Modified: llvm/trunk/lib/Transforms/Utils/AddDiscriminators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/AddDiscriminators.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/AddDiscriminators.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/AddDiscriminators.cpp Tue Jan 26 12:48:36 2016
@@ -80,7 +80,7 @@ struct AddDiscriminators : public Functi
 
   bool runOnFunction(Function &F) override;
 };
-}
+} // end anonymous namespace
 
 char AddDiscriminators::ID = 0;
 INITIALIZE_PASS_BEGIN(AddDiscriminators, "add-discriminators",
@@ -217,7 +217,7 @@ bool AddDiscriminators::runOnFunction(Fu
   // Sample base profile needs to distinguish different function calls within
   // a same source line for correct profile annotation.
   for (BasicBlock &B : F) {
-    const DILocation *FirstDIL = NULL;
+    const DILocation *FirstDIL = nullptr;
     for (auto &I : B.getInstList()) {
       CallInst *Current = dyn_cast<CallInst>(&I);
       if (!Current || isa<DbgInfoIntrinsic>(&I))

Modified: llvm/trunk/lib/Transforms/Utils/SanitizerStats.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SanitizerStats.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SanitizerStats.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SanitizerStats.cpp Tue Jan 26 12:48:36 2016
@@ -27,7 +27,7 @@ SanitizerStatReport::SanitizerStatReport
   EmptyModuleStatsTy = makeModuleStatsTy();
 
   ModuleStatsGV = new GlobalVariable(*M, EmptyModuleStatsTy, false,
-                                     GlobalValue::InternalLinkage, 0);
+                                     GlobalValue::InternalLinkage, nullptr);
 }
 
 ArrayType *SanitizerStatReport::makeModuleStatsArrayTy() {

Modified: llvm/trunk/tools/sanstats/sanstats.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/sanstats/sanstats.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/tools/sanstats/sanstats.cpp (original)
+++ llvm/trunk/tools/sanstats/sanstats.cpp Tue Jan 26 12:48:36 2016
@@ -51,12 +51,12 @@ const char *ReadModule(char SizeofPtr, c
   while (Begin != End && *Begin)
     ++Begin;
   if (Begin == End)
-    return 0;
+    return nullptr;
   StringRef Filename(FilenameBegin, Begin - FilenameBegin);
 
   ++Begin;
   if (Begin == End)
-    return 0;
+    return nullptr;
 
   symbolize::LLVMSymbolizer::Options SymbolizerOptions;
   SymbolizerOptions.Demangle = ClDemangle;
@@ -70,11 +70,11 @@ const char *ReadModule(char SizeofPtr, c
     Begin += SizeofPtr;
 
     if (Begin > End)
-      return 0;
+      return nullptr;
     if (Addr == 0 && Data == 0)
       return Begin;
     if (Begin == End)
-      return 0;
+      return nullptr;
 
     ErrorOr<DILineInfo> LineInfo = Symbolizer.symbolizeCode(Filename, Addr);
     if (LineInfo) {
@@ -129,7 +129,7 @@ int main(int argc, char **argv) {
   char SizeofPtr = *Begin++;
   while (Begin != End) {
     Begin = ReadModule(SizeofPtr, Begin, End);
-    if (Begin == 0) {
+    if (Begin == nullptr) {
       errs() << argv[0] << ": " << ClInputFile << ": short read\n";
       return 1;
     }

Modified: llvm/trunk/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp Tue Jan 26 12:48:36 2016
@@ -37,14 +37,13 @@ public:
     return SectionMemoryManager::needsToReserveAllocationSpace();
   }
 
-  bool finalizeMemory(std::string *ErrMsg = 0) override {
+  bool finalizeMemory(std::string *ErrMsg = nullptr) override {
     ++FinalizationCount;
     return SectionMemoryManager::finalizeMemory(ErrMsg);
   }
 };
 
 TEST(ObjectLinkingLayerTest, TestSetProcessAllSections) {
-
   class SectionMemoryManagerWrapper : public SectionMemoryManager {
   public:
     SectionMemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
@@ -113,9 +112,7 @@ TEST(ObjectLinkingLayerTest, TestSetProc
   }
 }
 
-
 TEST_F(ObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
-
   if (!TM)
     return;
 
@@ -187,7 +184,6 @@ TEST_F(ObjectLinkingLayerExecutionTest,
 }
 
 TEST_F(ObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
-
   if (!TM)
     return;
 
@@ -250,4 +246,4 @@ TEST_F(ObjectLinkingLayerExecutionTest,
          "(multiple unrelated objects loaded prior to finalization)";
 }
 
-}
+} // end anonymous namespace

Modified: llvm/trunk/unittests/IR/VerifierTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/VerifierTest.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/VerifierTest.cpp (original)
+++ llvm/trunk/unittests/IR/VerifierTest.cpp Tue Jan 26 12:48:36 2016
@@ -1,4 +1,4 @@
-//===- llvm/unittest/IR/VerifierTest.cpp - Verifier unit tests ------------===//
+//===- llvm/unittest/IR/VerifierTest.cpp - Verifier unit tests --*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -126,7 +126,8 @@ TEST(VerifierTest, CrossModuleMetadataRe
   Module M2("M2", C);
   GlobalVariable *newGV =
       new GlobalVariable(M1, Type::getInt8Ty(C), false,
-                         GlobalVariable::ExternalLinkage, NULL, "Some Global");
+                         GlobalVariable::ExternalLinkage, nullptr,
+                         "Some Global");
 
   DIBuilder dbuilder(M2);
   auto CU = dbuilder.createCompileUnit(dwarf::DW_LANG_Julia, "test.jl", ".",
@@ -143,5 +144,5 @@ TEST(VerifierTest, CrossModuleMetadataRe
   EXPECT_TRUE(StringRef(ErrorOS.str())
                   .startswith("Referencing global in another module!"));
 }
-}
-}
+} // end anonymous namespace
+} // end namespace llvm

Modified: llvm/trunk/unittests/ProfileData/InstrProfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/InstrProfTest.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/unittests/ProfileData/InstrProfTest.cpp (original)
+++ llvm/trunk/unittests/ProfileData/InstrProfTest.cpp Tue Jan 26 12:48:36 2016
@@ -14,7 +14,6 @@
 #include "llvm/ProfileData/InstrProfWriter.h"
 #include "llvm/Support/Compression.h"
 #include "gtest/gtest.h"
-
 #include <cstdarg>
 
 using namespace llvm;
@@ -490,22 +489,24 @@ ValueProfNode Site1Values[5] = {{{uint64
                                 {{uint64_t("callee2"), 1000}, &Site1Values[2]},
                                 {{uint64_t("callee3"), 500}, &Site1Values[3]},
                                 {{uint64_t("callee4"), 300}, &Site1Values[4]},
-                                {{uint64_t("callee5"), 100}, 0}};
+                                {{uint64_t("callee5"), 100}, nullptr}};
 
 ValueProfNode Site2Values[4] = {{{uint64_t("callee5"), 800}, &Site2Values[1]},
                                 {{uint64_t("callee3"), 1000}, &Site2Values[2]},
                                 {{uint64_t("callee2"), 2500}, &Site2Values[3]},
-                                {{uint64_t("callee1"), 1300}, 0}};
+                                {{uint64_t("callee1"), 1300}, nullptr}};
 
 ValueProfNode Site3Values[3] = {{{uint64_t("callee6"), 800}, &Site3Values[1]},
                                 {{uint64_t("callee3"), 1000}, &Site3Values[2]},
-                                {{uint64_t("callee4"), 5500}, 0}};
+                                {{uint64_t("callee4"), 5500}, nullptr}};
 
 ValueProfNode Site4Values[2] = {{{uint64_t("callee2"), 1800}, &Site4Values[1]},
-                                {{uint64_t("callee3"), 2000}, 0}};
+                                {{uint64_t("callee3"), 2000}, nullptr}};
 
 static ValueProfNode *ValueProfNodes[5] = {&Site1Values[0], &Site2Values[0],
-                                           &Site3Values[0], &Site4Values[0], 0};
+                                           &Site3Values[0], &Site4Values[0],
+                                           nullptr};
+
 static uint16_t NumValueSites[IPVK_Last + 1] = {5};
 TEST_F(InstrProfTest, runtime_value_prof_data_read_write) {
   ValueProfRuntimeRecord RTRecord;
@@ -516,7 +517,7 @@ TEST_F(InstrProfTest, runtime_value_prof
 
   InstrProfRecord Record("caller", 0x1234, {1ULL << 31, 2});
 
-  VPData->deserializeTo(Record, 0);
+  VPData->deserializeTo(Record, nullptr);
 
   // Now read data from Record and sanity check the data
   ASSERT_EQ(5U, Record.getNumValueSites(IPVK_IndirectCallTarget));
@@ -687,7 +688,7 @@ TEST_F(InstrProfTest, instr_prof_symtab_
 
   for (unsigned I = 0; I < sizeof(Funcs) / sizeof(*Funcs); I++) {
     Function *F = M->getFunction(Funcs[I]);
-    ASSERT_TRUE(F != NULL);
+    ASSERT_TRUE(F != nullptr);
     std::string PGOName = getPGOFuncName(*F);
     uint64_t Key = IndexedInstrProf::ComputeHash(PGOName);
     ASSERT_EQ(StringRef(PGOName),

Modified: llvm/trunk/unittests/Support/AlignOfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/AlignOfTest.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/AlignOfTest.cpp (original)
+++ llvm/trunk/unittests/Support/AlignOfTest.cpp Tue Jan 26 12:48:36 2016
@@ -1,4 +1,4 @@
-//=== - llvm/unittest/Support/AlignOfTest.cpp - Alignment utility tests ----===//
+//=== - llvm/unittest/Support/AlignOfTest.cpp - Alignment utility tests ---===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -90,14 +90,14 @@ V7::~V7() {}
 V8::~V8() {}
 
 struct Abstract1 {
-  virtual ~Abstract1() {}
+  virtual ~Abstract1() = default;
   virtual void method() = 0;
 
   char c;
 };
 
 struct Abstract2 : Abstract1 {
-  virtual ~Abstract2() {}
+  ~Abstract2() override = default;
   double d;
 };
 
@@ -354,4 +354,4 @@ TEST(AlignOfTest, BasicAlignedArray) {
   EXPECT_EQ(2u, sizeof(AlignedCharArray<2, 2>));
   EXPECT_EQ(16u, sizeof(AlignedCharArray<2, 16>));
 }
-}
+} // end anonymous namespace

Modified: llvm/trunk/utils/TableGen/DFAPacketizerEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DFAPacketizerEmitter.cpp?rev=258831&r1=258830&r2=258831&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DFAPacketizerEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DFAPacketizerEmitter.cpp Tue Jan 26 12:48:36 2016
@@ -1,4 +1,4 @@
-//===- DFAPacketizerEmitter.cpp - Packetization DFA for a VLIW machine-----===//
+//===- DFAPacketizerEmitter.cpp - Packetization DFA for a VLIW machine ----===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -28,6 +28,7 @@
 #include <map>
 #include <string>
 #include <queue>
+
 using namespace llvm;
 
 // --------------------------------------------------------------------
@@ -73,7 +74,8 @@ namespace {
       InsnInput = addDFAFuncUnits(InsnInput, U);
     return InsnInput;
   }
-}
+} // end anonymous namespace
+
 // --------------------------------------------------------------------
 
 #ifndef NDEBUG
@@ -149,7 +151,7 @@ public:
 
   void run(raw_ostream &OS);
 };
-} // End anonymous namespace.
+} // end anonymous namespace
 
 //
 //
@@ -234,7 +236,7 @@ class State {
   //
   bool hasTransition(std::vector<unsigned> InsnClass) const;
 };
-} // End anonymous namespace.
+} // end anonymous namespace
 
 //
 // class DFA: deterministic finite automaton for processor resource tracking.
@@ -262,7 +264,7 @@ public:
                  int numInsnClasses = 0,
                  int maxResources = 0, int numCombos = 0, int maxStages = 0);
 };
-} // End anonymous namespace.
+} // end anonymous namespace
 
 #ifndef NDEBUG
 // To enable debugging, run llvm-tblgen with: "-debug-only dfa-emitter".
@@ -305,7 +307,7 @@ void dbgsIndent(unsigned indent) {
     DEBUG(dbgs() << " ");
   }
 }
-#endif
+#endif // NDEBUG
 
 //
 // Constructors and destructors for State and DFA
@@ -454,7 +456,6 @@ void State::AddInsnClassStages(std::vect
   }
 }
 
-
 //
 // canMaybeAddInsnClass - Quickly verifies if an instruction of type InsnClass
 // may be a valid transition from this state i.e., can an instruction of type
@@ -505,7 +506,6 @@ bool State::canMaybeAddInsnClass(std::ve
   return false;
 }
 
-
 const State &DFA::newState() {
   auto IterPair = states.insert(State());
   assert(IterPair.second && "State already exists");
@@ -518,7 +518,6 @@ DFAPacketizerEmitter::DFAPacketizerEmitt
   TargetName(CodeGenTarget(R).getName()),
   allInsnClasses(), Records(R) {}
 
-
 //
 // writeTableAndAPI - Print out a table representing the DFA and the
 // associated API to create a DFA packetizer.
@@ -626,7 +625,6 @@ void DFA::writeTableAndAPI(raw_ostream &
   OS << "};\n";
   OS << "} // namespace\n";
 
-
   //
   // Emit DFA Packetizer tables if the target is a VLIW machine.
   //
@@ -640,7 +638,6 @@ void DFA::writeTableAndAPI(raw_ostream &
   OS << "} // End llvm namespace \n";
 }
 
-
 //
 // collectAllFuncUnits - Construct a map of function unit names to bits.
 //
@@ -735,7 +732,6 @@ int DFAPacketizerEmitter::collectAllComb
   return numCombos;
 }
 
-
 //
 // collectOneInsnClass - Populate allInsnClasses with one instruction class
 //
@@ -940,7 +936,7 @@ void DFAPacketizerEmitter::run(raw_ostre
       //
       if (!current->hasTransition(InsnClass) &&
           current->canMaybeAddInsnClass(InsnClass, ComboBitToBitsMap)) {
-        const State *NewState = NULL;
+        const State *NewState = nullptr;
         current->AddInsnClass(InsnClass, ComboBitToBitsMap, NewStateResources);
         if (NewStateResources.size() == 0) {
           DEBUG(dbgs() << "  Skipped - no new states generated\n");
@@ -994,4 +990,4 @@ void EmitDFAPacketizer(RecordKeeper &RK,
   DFAPacketizerEmitter(RK).run(OS);
 }
 
-} // End llvm namespace
+} // end namespaec llvm




More information about the llvm-commits mailing list