Fix some Clang-tidy modernize warnings, other minor fixes.
authorEugene Zelenko <eugene.zelenko@gmail.com>
Wed, 4 Nov 2015 22:32:32 +0000 (22:32 +0000)
committerEugene Zelenko <eugene.zelenko@gmail.com>
Wed, 4 Nov 2015 22:32:32 +0000 (22:32 +0000)
Fixed warnings are: modernize-use-override, modernize-use-nullptr and modernize-redundant-void-arg.

Differential revision: http://reviews.llvm.org/D14312

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252087 91177308-0d34-0410-b5e6-96231b3b80d8

17 files changed:
include/llvm-c/Core.h
include/llvm/ProfileData/SampleProf.h
lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
lib/MC/MCAsmStreamer.cpp
lib/Support/TimeValue.cpp
lib/Transforms/InstCombine/InstCombineAddSub.cpp
lib/Transforms/Instrumentation/SafeStack.cpp
lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
tools/lli/RemoteTarget.cpp
tools/llvm-mc/llvm-mc.cpp
tools/llvm-size/llvm-size.cpp
unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp
unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp
unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
unittests/ProfileData/InstrProfTest.cpp
utils/TableGen/OptParserEmitter.cpp

index 146758542662fa1c8b6c6e510848c1d3bd7e9c27..519363271ad57029c082fdfcda268aaaa759ef50 100644 (file)
@@ -256,7 +256,6 @@ typedef enum {
   LLVMCleanupPad     = 65,
   LLVMCatchEndPad    = 66,
   LLVMCleanupEndPad  = 67
   LLVMCleanupPad     = 65,
   LLVMCatchEndPad    = 66,
   LLVMCleanupEndPad  = 67
-
 } LLVMOpcode;
 
 typedef enum {
 } LLVMOpcode;
 
 typedef enum {
@@ -436,7 +435,6 @@ void LLVMInitializeCore(LLVMPassRegistryRef R);
     @see ManagedStatic */
 void LLVMShutdown(void);
 
     @see ManagedStatic */
 void LLVMShutdown(void);
 
-
 /*===-- Error handling ----------------------------------------------------===*/
 
 char *LLVMCreateMessage(const char *Message);
 /*===-- Error handling ----------------------------------------------------===*/
 
 char *LLVMCreateMessage(const char *Message);
@@ -816,6 +814,7 @@ LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
+LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C);
 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
 
 /**
 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
 
 /**
@@ -827,6 +826,7 @@ LLVMTypeRef LLVMInt8Type(void);
 LLVMTypeRef LLVMInt16Type(void);
 LLVMTypeRef LLVMInt32Type(void);
 LLVMTypeRef LLVMInt64Type(void);
 LLVMTypeRef LLVMInt16Type(void);
 LLVMTypeRef LLVMInt32Type(void);
 LLVMTypeRef LLVMInt64Type(void);
+LLVMTypeRef LLVMInt128Type(void);
 LLVMTypeRef LLVMIntType(unsigned NumBits);
 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
 
 LLVMTypeRef LLVMIntType(unsigned NumBits);
 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
 
@@ -1030,7 +1030,6 @@ LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
  * @}
  */
 
  * @}
  */
 
-
 /**
  * @defgroup LLVMCCoreTypeSequential Sequential Types
  *
 /**
  * @defgroup LLVMCCoreTypeSequential Sequential Types
  *
@@ -1211,7 +1210,7 @@ LLVMTypeRef LLVMX86MMXType(void);
       macro(InsertElementInst)              \
       macro(InsertValueInst)                \
       macro(LandingPadInst)                 \
       macro(InsertElementInst)              \
       macro(InsertValueInst)                \
       macro(LandingPadInst)                 \
-      macro(CleanupPadInst)               \
+      macro(CleanupPadInst)                 \
       macro(PHINode)                        \
       macro(SelectInst)                     \
       macro(ShuffleVectorInst)              \
       macro(PHINode)                        \
       macro(SelectInst)                     \
       macro(ShuffleVectorInst)              \
@@ -1226,9 +1225,9 @@ LLVMTypeRef LLVMX86MMXType(void);
         macro(ResumeInst)                   \
         macro(CleanupReturnInst)            \
         macro(CatchReturnInst)              \
         macro(ResumeInst)                   \
         macro(CleanupReturnInst)            \
         macro(CatchReturnInst)              \
-        macro(CatchPadInst)               \
-        macro(TerminatePadInst)           \
-        macro(CatchEndPadInst)            \
+        macro(CatchPadInst)                 \
+        macro(TerminatePadInst)             \
+        macro(CatchEndPadInst)              \
         macro(CleanupEndPadInst)            \
       macro(UnaryInstruction)               \
         macro(AllocaInst)                   \
         macro(CleanupEndPadInst)            \
       macro(UnaryInstruction)               \
         macro(AllocaInst)                   \
@@ -3037,6 +3036,6 @@ LLVMBool LLVMIsMultithreaded(void);
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
-#endif /* !defined(__cplusplus) */
+#endif
 
 
-#endif /* !defined(LLVM_C_CORE_H) */
+#endif /* LLVM_C_CORE_H */
index 96df141e4b2556ad9543db365d78418923d99d9f..7b7e6c46cd84bdbd4853c0900802bb3aa12ab8d0 100644 (file)
@@ -11,6 +11,7 @@
 // sample profile data.
 //
 //===----------------------------------------------------------------------===//
 // sample profile data.
 //
 //===----------------------------------------------------------------------===//
+
 #ifndef LLVM_PROFILEDATA_SAMPLEPROF_H_
 #define LLVM_PROFILEDATA_SAMPLEPROF_H_
 
 #ifndef LLVM_PROFILEDATA_SAMPLEPROF_H_
 #define LLVM_PROFILEDATA_SAMPLEPROF_H_
 
@@ -245,7 +246,7 @@ public:
   findFunctionSamplesAt(const CallsiteLocation &Loc) const {
     auto iter = CallsiteSamples.find(Loc);
     if (iter == CallsiteSamples.end()) {
   findFunctionSamplesAt(const CallsiteLocation &Loc) const {
     auto iter = CallsiteSamples.find(Loc);
     if (iter == CallsiteSamples.end()) {
-      return NULL;
+      return nullptr;
     } else {
       return &iter->second;
     }
     } else {
       return &iter->second;
     }
@@ -322,8 +323,8 @@ private:
   CallsiteSampleMap CallsiteSamples;
 };
 
   CallsiteSampleMap CallsiteSamples;
 };
 
-} // End namespace sampleprof
+} // end namespace sampleprof
 
 
-} // End namespace llvm
+} // end namespace llvm
 
 #endif // LLVM_PROFILEDATA_SAMPLEPROF_H_
 
 #endif // LLVM_PROFILEDATA_SAMPLEPROF_H_
index f8cdde203187e9e5089b2a5d65787f2cc067c7de..4ad3e1867328f242c10bc27eeb62f169ac3c87e6 100644 (file)
@@ -41,7 +41,7 @@ void DwarfAccelTable::AddName(DwarfStringPoolEntryRef Name, const DIE *die,
   DIEs.Values.push_back(new (Allocator) HashDataContents(die, Flags));
 }
 
   DIEs.Values.push_back(new (Allocator) HashDataContents(die, Flags));
 }
 
-void DwarfAccelTable::ComputeBucketCount(void) {
+void DwarfAccelTable::ComputeBucketCount() {
   // First get the number of unique hashes.
   std::vector<uint32_t> uniques(Data.size());
   for (size_t i = 0, e = Data.size(); i < e; ++i)
   // First get the number of unique hashes.
   std::vector<uint32_t> uniques(Data.size());
   for (size_t i = 0, e = Data.size(); i < e; ++i)
index 2f06415c21cd3b289610118aa9042bacb6ebe082..28adb5e22a0f0a961570a2a3f9e00c7807cc5ab8 100644 (file)
@@ -1,4 +1,4 @@
-//===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output --------------------===//
+//===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output ----------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -33,6 +33,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
 #include <cctype>
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
 #include <cctype>
+
 using namespace llvm;
 
 namespace {
 using namespace llvm;
 
 namespace {
@@ -655,7 +656,6 @@ static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
   OS << '"';
 }
 
   OS << '"';
 }
 
-
 void MCAsmStreamer::EmitBytes(StringRef Data) {
   assert(getCurrentSection().first &&
          "Cannot emit contents before setting section!");
 void MCAsmStreamer::EmitBytes(StringRef Data) {
   assert(getCurrentSection().first &&
          "Cannot emit contents before setting section!");
@@ -777,7 +777,6 @@ void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Value) {
   EmitEOL();
 }
 
   EmitEOL();
 }
 
-
 /// EmitFill - Emit NumBytes bytes worth of the value specified by
 /// FillValue.  This implements directives such as '.space'.
 void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
 /// EmitFill - Emit NumBytes bytes worth of the value specified by
 /// FillValue.  This implements directives such as '.space'.
 void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
@@ -867,7 +866,6 @@ bool MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
   return false;
 }
 
   return false;
 }
 
-
 void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
   assert(MAI->hasSingleParameterDotFile());
   OS << "\t.file\t";
 void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
   assert(MAI->hasSingleParameterDotFile());
   OS << "\t.file\t";
@@ -1230,7 +1228,7 @@ void MCAsmStreamer::EmitWinCFIPushFrame(bool Code) {
   EmitEOL();
 }
 
   EmitEOL();
 }
 
-void MCAsmStreamer::EmitWinCFIEndProlog(void) {
+void MCAsmStreamer::EmitWinCFIEndProlog() {
   MCStreamer::EmitWinCFIEndProlog();
 
   OS << "\t.seh_endprologue";
   MCStreamer::EmitWinCFIEndProlog();
 
   OS << "\t.seh_endprologue";
index 136b93eceefaa0484d2783f1f8d7c978f8a00785..94a4c011693c6df834bfba5dc80a8d24d07b5740 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/Config/config.h"
 
 namespace llvm {
 #include "llvm/Config/config.h"
 
 namespace llvm {
+
 using namespace sys;
 
 const TimeValue::SecondsType
 using namespace sys;
 
 const TimeValue::SecondsType
@@ -22,8 +23,7 @@ const TimeValue::SecondsType
 const TimeValue::SecondsType
   TimeValue::Win32ZeroTimeSeconds = -12591158400ULL;
 
 const TimeValue::SecondsType
   TimeValue::Win32ZeroTimeSeconds = -12591158400ULL;
 
-void
-TimeValue::normalize( void ) {
+void TimeValue::normalize() {
   if ( nanos_ >= NANOSECONDS_PER_SECOND ) {
     do {
       seconds_++;
   if ( nanos_ >= NANOSECONDS_PER_SECOND ) {
     do {
       seconds_++;
@@ -45,7 +45,7 @@ TimeValue::normalize( void ) {
   }
 }
 
   }
 }
 
-}
+} // namespace llvm
 
 /// Include the platform-specific portion of TimeValue class
 #ifdef LLVM_ON_UNIX
 
 /// Include the platform-specific portion of TimeValue class
 #ifdef LLVM_ON_UNIX
index ba6e687973b0765edd4beaecbd6bd90b30a8168e..17bbc5d2870dfa0d14034daacd10d091d39b6414 100644 (file)
@@ -1,4 +1,4 @@
-//===- InstCombineAddSub.cpp ----------------------------------------------===//
+//===- InstCombineAddSub.cpp ------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,6 +17,7 @@
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/GetElementPtrTypeIterator.h"
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/GetElementPtrTypeIterator.h"
 #include "llvm/IR/PatternMatch.h"
+
 using namespace llvm;
 using namespace PatternMatch;
 
 using namespace llvm;
 using namespace PatternMatch;
 
@@ -67,17 +68,17 @@ namespace {
 
   private:
     bool insaneIntVal(int V) { return V > 4 || V < -4; }
 
   private:
     bool insaneIntVal(int V) { return V > 4 || V < -4; }
-    APFloat *getFpValPtr(void)
+    APFloat *getFpValPtr()
       { return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }
       { return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }
-    const APFloat *getFpValPtr(void) const
+    const APFloat *getFpValPtr() const
       { return reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]); }
 
       { return reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]); }
 
-    const APFloat &getFpVal(void) const {
+    const APFloat &getFpVal() const {
       assert(IsFp && BufHasFpVal && "Incorret state");
       return *getFpValPtr();
     }
 
       assert(IsFp && BufHasFpVal && "Incorret state");
       return *getFpValPtr();
     }
 
-    APFloat &getFpVal(void) {
+    APFloat &getFpVal() {
       assert(IsFp && BufHasFpVal && "Incorret state");
       return *getFpValPtr();
     }
       assert(IsFp && BufHasFpVal && "Incorret state");
       return *getFpValPtr();
     }
@@ -92,8 +93,8 @@ namespace {
     // TODO: We should get rid of this function when APFloat can be constructed
     //       from an *SIGNED* integer.
     APFloat createAPFloatFromInt(const fltSemantics &Sem, int Val);
     // TODO: We should get rid of this function when APFloat can be constructed
     //       from an *SIGNED* integer.
     APFloat createAPFloatFromInt(const fltSemantics &Sem, int Val);
-  private:
 
 
+  private:
     bool IsFp;
 
     // True iff FpValBuf contains an instance of APFloat.
     bool IsFp;
 
     // True iff FpValBuf contains an instance of APFloat.
@@ -114,10 +115,10 @@ namespace {
   ///
   class FAddend {
   public:
   ///
   class FAddend {
   public:
-    FAddend() { Val = nullptr; }
+    FAddend() : Val(nullptr) {}
 
 
-    Value *getSymVal (void) const { return Val; }
-    const FAddendCoef &getCoef(void) const { return Coeff; }
+    Value *getSymVal() const { return Val; }
+    const FAddendCoef &getCoef() const { return Coeff; }
 
     bool isConstant() const { return Val == nullptr; }
     bool isZero() const { return Coeff.isZero(); }
 
     bool isConstant() const { return Val == nullptr; }
     bool isZero() const { return Coeff.isZero(); }
@@ -182,7 +183,6 @@ namespace {
     InstCombiner::BuilderTy *Builder;
     Instruction *Instr;
 
     InstCombiner::BuilderTy *Builder;
     Instruction *Instr;
 
-  private:
      // Debugging stuff are clustered here.
     #ifndef NDEBUG
       unsigned CreateInstrNum;
      // Debugging stuff are clustered here.
     #ifndef NDEBUG
       unsigned CreateInstrNum;
@@ -193,7 +193,8 @@ namespace {
       void incCreateInstNum() {}
     #endif
   };
       void incCreateInstNum() {}
     #endif
   };
-}
+
+} // anonymous namespace
 
 //===----------------------------------------------------------------------===//
 //
 
 //===----------------------------------------------------------------------===//
 //
@@ -602,7 +603,6 @@ Value *FAddCombine::simplify(Instruction *I) {
 }
 
 Value *FAddCombine::simplifyFAdd(AddendVect& Addends, unsigned InstrQuota) {
 }
 
 Value *FAddCombine::simplifyFAdd(AddendVect& Addends, unsigned InstrQuota) {
-
   unsigned AddendNum = Addends.size();
   assert(AddendNum <= 4 && "Too many addends");
 
   unsigned AddendNum = Addends.size();
   assert(AddendNum <= 4 && "Too many addends");
 
@@ -1421,7 +1421,6 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
   return Changed ? &I : nullptr;
 }
 
   return Changed ? &I : nullptr;
 }
 
-
 /// Optimize pointer differences into the same array into a size.  Consider:
 ///  &A[10] - &A[0]: we should compile this to "10".  LHS/RHS are the pointer
 /// operands to the ptrtoint instructions for the LHS/RHS of the subtract.
 /// Optimize pointer differences into the same array into a size.  Consider:
 ///  &A[10] - &A[0]: we should compile this to "10".  LHS/RHS are the pointer
 /// operands to the ptrtoint instructions for the LHS/RHS of the subtract.
@@ -1589,7 +1588,6 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
     }
   }
 
     }
   }
 
-
   {
     Value *Y;
     // X-(X+Y) == -Y    X-(Y+X) == -Y
   {
     Value *Y;
     // X-(X+Y) == -Y    X-(Y+X) == -Y
index f63f3a5f45f7637dcab9079d70b7a32aafb7f93a..d351358b463595a30e27afc92f7082330cdf18d1 100644 (file)
@@ -261,7 +261,7 @@ Value *SafeStack::getOrCreateUnsafeStackPtr(IRBuilder<> &IRB, Function &F) {
     // We use the initial-exec TLS model because we do not support the
     // variable living anywhere other than in the main executable.
     UnsafeStackPtr = new GlobalVariable(
     // We use the initial-exec TLS model because we do not support the
     // variable living anywhere other than in the main executable.
     UnsafeStackPtr = new GlobalVariable(
-        M, StackPtrTy, false, GlobalValue::ExternalLinkage, 0,
+        M, StackPtrTy, false, GlobalValue::ExternalLinkage, nullptr,
         UnsafeStackPtrVar, nullptr, GlobalValue::InitialExecTLSModel);
   } else {
     // The variable exists, check its type and attributes.
         UnsafeStackPtrVar, nullptr, GlobalValue::InitialExecTLSModel);
   } else {
     // The variable exists, check its type and attributes.
index 744ab4b91008b650adc5c0f39c16d71714751311..c812d618c16ac65de4a81a6a081cfcfd22cb95aa 100644 (file)
@@ -108,7 +108,7 @@ class MergedLoadStoreMotion : public FunctionPass {
 
 public:
   static char ID; // Pass identification, replacement for typeid
 
 public:
   static char ID; // Pass identification, replacement for typeid
-  explicit MergedLoadStoreMotion(void)
+  MergedLoadStoreMotion()
       : FunctionPass(ID), MD(nullptr), MagicCompileTimeControl(250) {
     initializeMergedLoadStoreMotionPass(*PassRegistry::getPassRegistry());
   }
       : FunctionPass(ID), MD(nullptr), MagicCompileTimeControl(250) {
     initializeMergedLoadStoreMotionPass(*PassRegistry::getPassRegistry());
   }
@@ -159,7 +159,7 @@ private:
 };
 
 char MergedLoadStoreMotion::ID = 0;
 };
 
 char MergedLoadStoreMotion::ID = 0;
-}
+} // anonymous namespace
 
 ///
 /// \brief createMergedLoadStoreMotionPass - The public interface to this file.
 
 ///
 /// \brief createMergedLoadStoreMotionPass - The public interface to this file.
index 850fdc506999b81ae7fb4597607586d5fff5ab08..95e1511eaaf533c790b01ec7a561143fe9fab027 100644 (file)
@@ -1,4 +1,4 @@
-//===- RemoteTarget.cpp - LLVM Remote process JIT execution --------------===//
+//===- RemoteTarget.cpp - LLVM Remote process JIT execution -----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -56,7 +56,7 @@ bool RemoteTarget::loadCode(uint64_t Address, const void *Data, size_t Size) {
 }
 
 bool RemoteTarget::executeCode(uint64_t Address, int &RetVal) {
 }
 
 bool RemoteTarget::executeCode(uint64_t Address, int &RetVal) {
-  int (*fn)(void) = (int(*)(void))Address;
+  int (*fn)() = (int(*)())Address;
   RetVal = fn();
   return true;
 }
   RetVal = fn();
   return true;
 }
index 6e6b748c3d29d7d44cd3f46c2afa06bc8397812e..f3b34e2502fe70bd7b46c4b46b1dfb214d751eee 100644 (file)
@@ -1,4 +1,4 @@
-//===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===//
+//===-- llvm-mc.cpp - Machine Code Hacking Driver ---------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -39,6 +39,7 @@
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/ToolOutputFile.h"
+
 using namespace llvm;
 
 static cl::opt<std::string>
 using namespace llvm;
 
 static cl::opt<std::string>
@@ -234,7 +235,7 @@ static void setDwarfDebugFlags(int argc, char **argv) {
 }
 
 static std::string DwarfDebugProducer;
 }
 
 static std::string DwarfDebugProducer;
-static void setDwarfDebugProducer(void) {
+static void setDwarfDebugProducer() {
   if(!getenv("DEBUG_PRODUCER"))
     return;
   DwarfDebugProducer += getenv("DEBUG_PRODUCER");
   if(!getenv("DEBUG_PRODUCER"))
     return;
   DwarfDebugProducer += getenv("DEBUG_PRODUCER");
index de2b0450523465421fef87f6cceca8751c74f0ac..bb299884f25ef4d050ade0df4180c3c9202cef3c 100644 (file)
@@ -1,4 +1,4 @@
-//===-- llvm-size.cpp - Print the size of each object section -------------===//
+//===-- llvm-size.cpp - Print the size of each object section ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -30,6 +30,7 @@
 #include <algorithm>
 #include <string>
 #include <system_error>
 #include <algorithm>
 #include <string>
 #include <system_error>
+
 using namespace llvm;
 using namespace object;
 
 using namespace llvm;
 using namespace object;
 
@@ -98,7 +99,7 @@ static size_t getNumLengthAsString(uint64_t num) {
 }
 
 /// @brief Return the printing format for the Radix.
 }
 
 /// @brief Return the printing format for the Radix.
-static const char *getRadixFmt(void) {
+static const char *getRadixFmt() {
   switch (Radix) {
   case octal:
     return PRIo64;
   switch (Radix) {
   case octal:
     return PRIo64;
index c84a16bf687c490a10c9407cec039e52d0eb5417..65f969f24c6c3d223efe6357d802df76da1f35d5 100644 (file)
@@ -1,4 +1,4 @@
-//===- MCJITMultipeModuleTest.cpp - Unit tests for the MCJIT-----*- C++ -*-===//
+//===- MCJITMultipeModuleTest.cpp - Unit tests for the MCJIT ----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -228,13 +228,13 @@ TEST_F(MCJITMultipleModuleTest, two_module_global_variables_case) {
   uint64_t FBPtr = TheJIT->getFunctionAddress(FB->getName().str());
   TheJIT->finalizeObject();
   EXPECT_TRUE(0 != FBPtr);
   uint64_t FBPtr = TheJIT->getFunctionAddress(FB->getName().str());
   TheJIT->finalizeObject();
   EXPECT_TRUE(0 != FBPtr);
-  int32_t(*FuncPtr)(void) = (int32_t(*)(void))FBPtr;
+  int32_t(*FuncPtr)() = (int32_t(*)())FBPtr;
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function in module B";
 
   uint64_t FAPtr = TheJIT->getFunctionAddress(FA->getName().str());
   EXPECT_TRUE(0 != FAPtr);
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function in module B";
 
   uint64_t FAPtr = TheJIT->getFunctionAddress(FA->getName().str());
   EXPECT_TRUE(0 != FAPtr);
-  FuncPtr = (int32_t(*)(void))FAPtr;
+  FuncPtr = (int32_t(*)())FAPtr;
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function in module A";
 }
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function in module A";
 }
index ff5b6e3deccca61fd6e0ec9c151e70254c005119..2e3d2b6665a516e82bcac37492fbceec2539f320 100644 (file)
@@ -78,7 +78,6 @@ private:
 
 class MCJITObjectCacheTest : public testing::Test, public MCJITTestBase {
 protected:
 
 class MCJITObjectCacheTest : public testing::Test, public MCJITTestBase {
 protected:
-
   enum {
     OriginalRC = 6,
     ReplacementRC = 7
   enum {
     OriginalRC = 6,
     ReplacementRC = 7
@@ -101,7 +100,7 @@ protected:
     EXPECT_TRUE(nullptr != vPtr)
       << "Unable to get pointer to main() from JIT";
 
     EXPECT_TRUE(nullptr != vPtr)
       << "Unable to get pointer to main() from JIT";
 
-    int (*FuncPtr)(void) = (int(*)(void))(intptr_t)vPtr;
+    int (*FuncPtr)() = (int(*)())(intptr_t)vPtr;
     int returnCode = FuncPtr();
     EXPECT_EQ(returnCode, ExpectedRC);
   }
     int returnCode = FuncPtr();
     EXPECT_EQ(returnCode, ExpectedRC);
   }
@@ -119,7 +118,6 @@ TEST_F(MCJITObjectCacheTest, SetNullObjectCache) {
   compileAndRun();
 }
 
   compileAndRun();
 }
 
-
 TEST_F(MCJITObjectCacheTest, VerifyBasicObjectCaching) {
   SKIP_UNSUPPORTED_PLATFORM;
 
 TEST_F(MCJITObjectCacheTest, VerifyBasicObjectCaching) {
   SKIP_UNSUPPORTED_PLATFORM;
 
@@ -228,5 +226,4 @@ TEST_F(MCJITObjectCacheTest, VerifyNonLoadFromCache) {
   EXPECT_FALSE(Cache->wereDuplicatesInserted());
 }
 
   EXPECT_FALSE(Cache->wereDuplicatesInserted());
 }
 
-} // Namespace
-
+} // end anonymous namespace
index 0f10441006ad80eb9b16cdbe34b2ddccfb20a98f..744bfdb4a01bc175923ec9ada297f19d524db842 100644 (file)
@@ -89,7 +89,7 @@ TEST_F(MCJITTest, run_main) {
   EXPECT_TRUE(0 != ptr)
     << "Unable to get pointer to main() from JIT";
 
   EXPECT_TRUE(0 != ptr)
     << "Unable to get pointer to main() from JIT";
 
-  int (*FuncPtr)(void) = (int(*)(void))ptr;
+  int (*FuncPtr)() = (int(*)())ptr;
   int returnCode = FuncPtr();
   EXPECT_EQ(returnCode, rc);
 }
   int returnCode = FuncPtr();
   EXPECT_EQ(returnCode, rc);
 }
@@ -109,7 +109,7 @@ TEST_F(MCJITTest, return_global) {
   uint64_t rgvPtr = TheJIT->getFunctionAddress(ReturnGlobal->getName().str());
   EXPECT_TRUE(0 != rgvPtr);
 
   uint64_t rgvPtr = TheJIT->getFunctionAddress(ReturnGlobal->getName().str());
   EXPECT_TRUE(0 != rgvPtr);
 
-  int32_t(*FuncPtr)(void) = (int32_t(*)(void))rgvPtr;
+  int32_t(*FuncPtr)() = (int32_t(*)())rgvPtr;
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function";
 }
   EXPECT_EQ(initialNum, FuncPtr())
     << "Invalid value for global returned from JITted function";
 }
@@ -181,7 +181,7 @@ TEST_F(MCJITTest, multiple_functions) {
   EXPECT_TRUE(0 != ptr)
     << "Unable to get pointer to outer function from JIT";
 
   EXPECT_TRUE(0 != ptr)
     << "Unable to get pointer to outer function from JIT";
 
-  int32_t(*FuncPtr)(void) = (int32_t(*)(void))ptr;
+  int32_t(*FuncPtr)() = (int32_t(*)())ptr;
   EXPECT_EQ(innerRetVal, FuncPtr())
     << "Incorrect result returned from function";
 }
   EXPECT_EQ(innerRetVal, FuncPtr())
     << "Incorrect result returned from function";
 }
index 84b9d8d94076f275f08a703f95ac8f2514fc3228..07707c91cd99eec7f13b67b0ed68f84963f84349 100644 (file)
@@ -23,7 +23,6 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef)
 
 class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest {
 protected:
 
 class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest {
 protected:
-
   std::unique_ptr<Module> createTestModule(const Triple &TT) {
     ModuleBuilder MB(getGlobalContext(), TT.str(), "");
     Function *TestFunc = MB.createFunctionDecl<int()>("testFunc");
   std::unique_ptr<Module> createTestModule(const Triple &TT) {
     ModuleBuilder MB(getGlobalContext(), TT.str(), "");
     Function *TestFunc = MB.createFunctionDecl<int()>("testFunc");
@@ -37,9 +36,9 @@ protected:
     return MB.takeModule();
   }
 
     return MB.takeModule();
   }
 
-  typedef int (*MainFnTy)(void);
+  typedef int (*MainFnTy)();
 
 
-  static int myTestFuncImpl(void) {
+  static int myTestFuncImpl() {
     return 42;
   }
 
     return 42;
   }
 
@@ -66,16 +65,15 @@ protected:
     auto *ET = CCtx->APIExecTest;
     CCtx->M = ET->createTestModule(ET->TM->getTargetTriple());
     CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, wrap(CCtx->M.get()),
     auto *ET = CCtx->APIExecTest;
     CCtx->M = ET->createTestModule(ET->TM->getTargetTriple());
     CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, wrap(CCtx->M.get()),
-                                          myResolver, 0);
+                                          myResolver, nullptr);
     CCtx->Compiled = true;
     LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(JITStack, "main");
     LLVMOrcSetIndirectStubPointer(JITStack, "foo", MainAddr);
     return MainAddr;
   }
     CCtx->Compiled = true;
     LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(JITStack, "main");
     LLVMOrcSetIndirectStubPointer(JITStack, "foo", MainAddr);
     return MainAddr;
   }
-
 };
 
 };
 
-char *OrcCAPIExecutionTest::testFuncName = 0;
+char *OrcCAPIExecutionTest::testFuncName = nullptr;
 
 TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
   if (!TM)
 
 TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
   if (!TM)
@@ -89,7 +87,7 @@ TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
-    LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+    LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
@@ -113,7 +111,7 @@ TEST_F(OrcCAPIExecutionTest, TestLazyIRCompilation) {
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
-    LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+    LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
@@ -158,4 +156,4 @@ TEST_F(OrcCAPIExecutionTest, TestDirectCallbacksAPI) {
   LLVMOrcDisposeInstance(JIT);
 }
 
   LLVMOrcDisposeInstance(JIT);
 }
 
-}
+} // namespace llvm
index 9a58e072cfa7da141dfe520dc4eae4f0bbc4ac81..64c50bf3225714d85868d9c02614210e0897aba1 100644 (file)
@@ -1,4 +1,4 @@
-//===- unittest/ProfileData/InstrProfTest.cpp -------------------------------=//
+//===- unittest/ProfileData/InstrProfTest.cpp -------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -132,14 +132,14 @@ TEST_F(InstrProfTest, get_icall_data_read_write) {
   InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
   InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
-  Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, 0);
+  Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, nullptr);
   // No valeu profile data at the second site.
   // No valeu profile data at the second site.
-  Record1.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+  Record1.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
   InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2}};
   InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2}};
-  Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, 0);
+  Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, nullptr);
   InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
   InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
-  Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, 0);
+  Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
 
   Writer.addRecord(std::move(Record1));
   Writer.addRecord(std::move(Record2));
 
   Writer.addRecord(std::move(Record1));
   Writer.addRecord(std::move(Record2));
@@ -183,44 +183,44 @@ TEST_F(InstrProfTest, get_icall_data_merge1) {
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3},
                               {(uint64_t) "callee4", 4}};
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3},
                               {(uint64_t) "callee4", 4}};
-  Record11.addValueData(IPVK_IndirectCallTarget, 0, VD0, 4, 0);
+  Record11.addValueData(IPVK_IndirectCallTarget, 0, VD0, 4, nullptr);
 
   // No valeu profile data at the second site.
 
   // No valeu profile data at the second site.
-  Record11.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+  Record11.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
 
   InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
 
   InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
-  Record11.addValueData(IPVK_IndirectCallTarget, 2, VD2, 3, 0);
+  Record11.addValueData(IPVK_IndirectCallTarget, 2, VD2, 3, nullptr);
 
   InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
 
   InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
-  Record11.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, 0);
+  Record11.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
 
   InstrProfValueData VD4[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
 
   InstrProfValueData VD4[] = {{(uint64_t) "callee1", 1},
                               {(uint64_t) "callee2", 2},
                               {(uint64_t) "callee3", 3}};
-  Record11.addValueData(IPVK_IndirectCallTarget, 4, VD4, 3, 0);
+  Record11.addValueData(IPVK_IndirectCallTarget, 4, VD4, 3, nullptr);
 
   // A differnt record for the same caller.
   Record12.reserveSites(IPVK_IndirectCallTarget, 5);
   InstrProfValueData VD02[] = {{(uint64_t) "callee2", 5},
                                {(uint64_t) "callee3", 3}};
 
   // A differnt record for the same caller.
   Record12.reserveSites(IPVK_IndirectCallTarget, 5);
   InstrProfValueData VD02[] = {{(uint64_t) "callee2", 5},
                                {(uint64_t) "callee3", 3}};
-  Record12.addValueData(IPVK_IndirectCallTarget, 0, VD02, 2, 0);
+  Record12.addValueData(IPVK_IndirectCallTarget, 0, VD02, 2, nullptr);
 
   // No valeu profile data at the second site.
 
   // No valeu profile data at the second site.
-  Record12.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+  Record12.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
 
   InstrProfValueData VD22[] = {{(uint64_t) "callee2", 1},
                                {(uint64_t) "callee3", 3},
                                {(uint64_t) "callee4", 4}};
 
   InstrProfValueData VD22[] = {{(uint64_t) "callee2", 1},
                                {(uint64_t) "callee3", 3},
                                {(uint64_t) "callee4", 4}};
-  Record12.addValueData(IPVK_IndirectCallTarget, 2, VD22, 3, 0);
+  Record12.addValueData(IPVK_IndirectCallTarget, 2, VD22, 3, nullptr);
 
 
-  Record12.addValueData(IPVK_IndirectCallTarget, 3, 0, 0, 0);
+  Record12.addValueData(IPVK_IndirectCallTarget, 3, nullptr, 0, nullptr);
 
   InstrProfValueData VD42[] = {{(uint64_t) "callee1", 1},
                                {(uint64_t) "callee2", 2},
                                {(uint64_t) "callee3", 3}};
 
   InstrProfValueData VD42[] = {{(uint64_t) "callee1", 1},
                                {(uint64_t) "callee2", 2},
                                {(uint64_t) "callee3", 3}};
-  Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, 0);
+  Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, nullptr);
 
   Writer.addRecord(std::move(Record11));
   // Merge profile data.
 
   Writer.addRecord(std::move(Record11));
   // Merge profile data.
index 9262d7c8a02c66b38c71eb5a984d3baf497f378a..c1b5e6510325ce2308524869094da38a1ac3be4a 100644 (file)
@@ -149,10 +149,10 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
                                     PE = I->first.end(); PI != PE; ++PI) {
       OS << "\"" << *PI << "\" COMMA ";
     }
                                     PE = I->first.end(); PI != PE; ++PI) {
       OS << "\"" << *PI << "\" COMMA ";
     }
-    OS << "0})\n";
+    OS << "nullptr})\n";
   }
   OS << "#undef COMMA\n";
   }
   OS << "#undef COMMA\n";
-  OS << "#endif\n\n";
+  OS << "#endif // PREFIX\n\n";
 
   OS << "/////////\n";
   OS << "// Groups\n\n";
 
   OS << "/////////\n";
   OS << "// Groups\n\n";
@@ -164,7 +164,7 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
     OS << "OPTION(";
 
     // The option prefix;
     OS << "OPTION(";
 
     // The option prefix;
-    OS << "0";
+    OS << "nullptr";
 
     // The option string.
     OS << ", \"" << R.getValueAsString("Name") << '"';
 
     // The option string.
     OS << ", \"" << R.getValueAsString("Name") << '"';
@@ -183,7 +183,7 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
       OS << "INVALID";
 
     // The other option arguments (unused for groups).
       OS << "INVALID";
 
     // The other option arguments (unused for groups).
-    OS << ", INVALID, 0, 0, 0";
+    OS << ", INVALID, nullptr, 0, 0";
 
     // The option help text.
     if (!isa<UnsetInit>(R.getValueInit("HelpText"))) {
 
     // The option help text.
     if (!isa<UnsetInit>(R.getValueInit("HelpText"))) {
@@ -191,10 +191,10 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
       OS << "       ";
       write_cstring(OS, R.getValueAsString("HelpText"));
     } else
       OS << "       ";
       write_cstring(OS, R.getValueAsString("HelpText"));
     } else
-      OS << ", 0";
+      OS << ", nullptr";
 
     // The option meta-variable name (unused).
 
     // The option meta-variable name (unused).
-    OS << ", 0)\n";
+    OS << ", nullptr)\n";
   }
   OS << "\n";
 
   }
   OS << "\n";
 
@@ -242,7 +242,7 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
     OS << ", ";
     std::vector<std::string> AliasArgs = R.getValueAsListOfStrings("AliasArgs");
     if (AliasArgs.size() == 0) {
     OS << ", ";
     std::vector<std::string> AliasArgs = R.getValueAsListOfStrings("AliasArgs");
     if (AliasArgs.size() == 0) {
-      OS << "0";
+      OS << "nullptr";
     } else {
       OS << "\"";
       for (size_t i = 0, e = AliasArgs.size(); i != e; ++i)
     } else {
       OS << "\"";
       for (size_t i = 0, e = AliasArgs.size(); i != e; ++i)
@@ -274,17 +274,17 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
       OS << "       ";
       write_cstring(OS, R.getValueAsString("HelpText"));
     } else
       OS << "       ";
       write_cstring(OS, R.getValueAsString("HelpText"));
     } else
-      OS << ", 0";
+      OS << ", nullptr";
 
     // The option meta-variable name.
     OS << ", ";
     if (!isa<UnsetInit>(R.getValueInit("MetaVarName")))
       write_cstring(OS, R.getValueAsString("MetaVarName"));
     else
 
     // The option meta-variable name.
     OS << ", ";
     if (!isa<UnsetInit>(R.getValueInit("MetaVarName")))
       write_cstring(OS, R.getValueAsString("MetaVarName"));
     else
-      OS << "0";
+      OS << "nullptr";
 
     OS << ")\n";
   }
 
     OS << ")\n";
   }
-  OS << "#endif\n";
+  OS << "#endif // OPTION\n";
 }
 } // end namespace llvm
 }
 } // end namespace llvm