Add explicit keywords.
authorDan Gohman <gohman@apple.com>
Tue, 25 Mar 2008 22:06:05 +0000 (22:06 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 25 Mar 2008 22:06:05 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8

23 files changed:
include/llvm/ADT/SmallPtrSet.h
include/llvm/Analysis/Dominators.h
include/llvm/ModuleProvider.h
include/llvm/Use.h
lib/AsmParser/LLLexer.h
lib/Bitcode/Reader/BitcodeReader.h
lib/ExecutionEngine/JIT/JIT.h
lib/ExecutionEngine/JIT/JITEmitter.cpp
lib/Support/CommandLine.cpp
lib/Target/ARM/ARMInstrInfo.h
lib/Target/ARM/ARMJITInfo.h
lib/Target/Alpha/AlphaJITInfo.h
lib/Target/CBackend/CBackend.cpp
lib/Target/CellSPU/SPUInstrInfo.h
lib/Target/Mips/MipsInstrInfo.h
lib/Target/PowerPC/PPCInstrInfo.h
lib/Target/Sparc/SparcInstrInfo.h
lib/Target/X86/X86InstrInfo.h
lib/Target/X86/X86JITInfo.h
lib/VMCore/Verifier.cpp
utils/TableGen/DAGISelEmitter.cpp
utils/TableGen/Record.h
utils/TableGen/RegisterInfoEmitter.cpp

index e165d145578164e9e67912d2c91f52109f705930..8b85a67afb78220869f23a5238fd650c6362a4ec 100644 (file)
@@ -57,7 +57,7 @@ protected:
   // Helper to copy construct a SmallPtrSet.
   SmallPtrSetImpl(const SmallPtrSetImpl& that);
 public:
-  SmallPtrSetImpl(unsigned SmallSize) {
+  explicit SmallPtrSetImpl(unsigned SmallSize) {
     assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
            "Initial size must be a power of two!");
     CurArray = &SmallArray[0];
@@ -140,7 +140,7 @@ class SmallPtrSetIteratorImpl {
 protected:
   const void *const *Bucket;
 public:
-  SmallPtrSetIteratorImpl(const void *const *BP) : Bucket(BP) {
+  explicit SmallPtrSetIteratorImpl(const void *const *BP) : Bucket(BP) {
     AdvanceIfNotValid();
   }
   
@@ -166,7 +166,8 @@ protected:
 template<typename PtrTy>
 class SmallPtrSetIterator : public SmallPtrSetIteratorImpl {
 public:
-  SmallPtrSetIterator(const void *const *BP) : SmallPtrSetIteratorImpl(BP) {}
+  explicit SmallPtrSetIterator(const void *const *BP)
+    : SmallPtrSetIteratorImpl(BP) {}
 
   // Most methods provided by baseclass.
   
index 80088fd6c6e9e22fac49653881548a8628337b24..8d333de6b0be64e40236e6b641c74827a8014025 100644 (file)
@@ -48,7 +48,7 @@ class DominatorBase {
 protected:
   std::vector<NodeT*> Roots;
   const bool IsPostDominators;
-  inline DominatorBase(bool isPostDom) : 
+  inline explicit DominatorBase(bool isPostDom) :
     Roots(), IsPostDominators(isPostDom) {}
 public:
 
@@ -294,7 +294,7 @@ protected:
   }
 
 public:
-  DominatorTreeBase(bool isPostDom) 
+  explicit DominatorTreeBase(bool isPostDom)
     : DominatorBase<NodeT>(isPostDom), DFSInfoValid(false), SlowQueries(0) {}
   virtual ~DominatorTreeBase() { reset(); }
 
index 17ff6b242da13f3612dd7b3c4caa88cc984eec90..65bcc763f1c6cdfeb21e0041bbac16690bfda9ce 100644 (file)
@@ -74,7 +74,7 @@ public:
 /// if we just have a Module.  Note that the ModuleProvider takes ownership of
 /// the Module specified.
 struct ExistingModuleProvider : public ModuleProvider {
-  ExistingModuleProvider(Module *M) {
+  explicit ExistingModuleProvider(Module *M) {
     TheModule = M;
   }
   bool materializeFunction(Function *F, std::string *ErrInfo = 0) {
index c81a903e8b0e6e1074fe3e7ca53e233e27b6463c..48384f29aced1d55e3b24297aac4e842d22a25ad 100644 (file)
@@ -107,7 +107,7 @@ class value_use_iterator : public forward_iterator<UserTy*, ptrdiff_t> {
   typedef value_use_iterator<UserTy> _Self;
 
   Use *U;
-  value_use_iterator(Use *u) : U(u) {}
+  explicit value_use_iterator(Use *u) : U(u) {}
   friend class Value;
 public:
   typedef typename super::reference reference;
index 7eaa9f9d0ab70e906a1f0f3ae5f45aa4e0a93d40..8b44b14cb741e9b14474772c3db420a7598f7bb6 100644 (file)
@@ -30,7 +30,7 @@ namespace llvm {
     
     std::string TheError;
   public:
-    LLLexer(MemoryBuffer *StartBuf);
+    explicit LLLexer(MemoryBuffer *StartBuf);
     ~LLLexer() {}
 
     const char *getTokStart() const { return TokStart; }
index 9a140d952416c3b41bbc580f1952cbbdb46e2e1d..86b00a5ef14cfdf51058d61b8e48f8bf8be3a231 100644 (file)
@@ -117,7 +117,8 @@ class BitcodeReader : public ModuleProvider {
   /// stream) and what linkage the original function had.
   DenseMap<Function*, std::pair<uint64_t, unsigned> > DeferredFunctionInfo;
 public:
-  BitcodeReader(MemoryBuffer *buffer) : Buffer(buffer), ErrorString(0) {
+  explicit BitcodeReader(MemoryBuffer *buffer)
+      : Buffer(buffer), ErrorString(0) {
     HasReversedFunctionsWithBodies = false;
   }
   ~BitcodeReader() {
index bf1e804cd412364444be90c0ba1b1d8dbf0728e0..69e301bf6d04bdb8fb08e0c1c1cd33f6d645b211 100644 (file)
@@ -37,7 +37,7 @@ private:
   std::vector<const GlobalVariable*> PendingGlobals;
 
 public:
-  JITState(ModuleProvider *MP) : PM(MP) {}
+  explicit JITState(ModuleProvider *MP) : PM(MP) {}
 
   FunctionPassManager &getPM(const MutexGuard &L) {
     return PM;
index b675811e437fd9b0f8dbd3df653275b221d331e3..8d5a94a50befcdbcfe3bd81bf88ae3f551f2ce66 100644 (file)
@@ -96,7 +96,7 @@ namespace {
 
     static JITResolver *TheJITResolver;
   public:
-    JITResolver(JIT &jit) : nextGOTIndex(0) {
+    explicit JITResolver(JIT &jit) : nextGOTIndex(0) {
       TheJIT = &jit;
 
       LazyResolverFn = jit.getJITInfo().getLazyResolverFunction(JITCompilerFn);
index b3f32e89fbdf85cde9902a006a58ded4901aadd1..24f220d5136783bc4f1143946f220bcf6b380c7e 100644 (file)
@@ -931,7 +931,7 @@ class HelpPrinter {
   }
 
 public:
-  HelpPrinter(bool showHidden) : ShowHidden(showHidden) {
+  explicit HelpPrinter(bool showHidden) : ShowHidden(showHidden) {
     EmptyArg = 0;
   }
 
index 4ce90fc56640ed801814c3c37032a7ce52ae2dcd..29ec8be188facef2849a7ded7d3463f760772e2a 100644 (file)
@@ -128,7 +128,7 @@ namespace ARMII {
 class ARMInstrInfo : public TargetInstrInfoImpl {
   const ARMRegisterInfo RI;
 public:
-  ARMInstrInfo(const ARMSubtarget &STI);
+  explicit ARMInstrInfo(const ARMSubtarget &STI);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should
index 20048793a8ac4164923dea5d28036ed159e0a68a..81d896b7f1ad44cba1ce3034aa31c2d28d3c95af 100644 (file)
@@ -22,7 +22,7 @@ namespace llvm {
   class ARMJITInfo : public TargetJITInfo {
     ARMTargetMachine &TM;
   public:
-    ARMJITInfo(ARMTargetMachine &tm) : TM(tm) {useGOT = 0;}
+    explicit ARMJITInfo(ARMTargetMachine &tm) : TM(tm) {useGOT = 0;}
 
     /// replaceMachineCodeForFunction - Make it so that calling the function
     /// whose machine code is at OLD turns into a call to NEW, perhaps by
index a12f54698b5550cdc44833c3dc21cd200620d7d0..29511694d842f621c831e698f72ae890b5df3e3a 100644 (file)
@@ -26,7 +26,7 @@ namespace llvm {
   protected:
     TargetMachine &TM;
   public:
-    AlphaJITInfo(TargetMachine &tm) : TM(tm)
+    explicit AlphaJITInfo(TargetMachine &tm) : TM(tm)
     { useGOT = true; }
 
     virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE);
index 24ac8f9e5c07bc2894bfbf0a33b88a1ac1a691aa..b05c5696faaf744288c72a9666afd559d26a7beb 100644 (file)
@@ -90,7 +90,7 @@ namespace {
 
   public:
     static char ID;
-    CWriter(std::ostream &o) 
+    explicit CWriter(std::ostream &o)
       : FunctionPass((intptr_t)&ID), Out(o), IL(0), Mang(0), LI(0), 
         TheModule(0), TAsm(0), TD(0) {}
 
index c5fe811f6e5fe2c47683483e0c994b1aca30bcea..dc492023bb58aea587754bccc1e449e02b47d4bf 100644 (file)
@@ -24,7 +24,7 @@ namespace llvm {
     SPUTargetMachine &TM;
     const SPURegisterInfo RI;
   public:
-    SPUInstrInfo(SPUTargetMachine &tm);
+    explicit SPUInstrInfo(SPUTargetMachine &tm);
 
     /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
     /// such, whenever a client has an instance of instruction info, it should
index a186f2cd796dc7772a82004da220c871f9f04887..9842414dbab89b1fa4032ed090b6a1cbb60b53be 100644 (file)
@@ -46,7 +46,7 @@ class MipsInstrInfo : public TargetInstrInfoImpl {
   MipsTargetMachine &TM;
   const MipsRegisterInfo RI;
 public:
-  MipsInstrInfo(MipsTargetMachine &TM);
+  explicit MipsInstrInfo(MipsTargetMachine &TM);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should
index e659129a2d467ba503146e97f00230b55f0d766a..d74399d4ad43d4c945327f20a9b793034b474ec3 100644 (file)
@@ -72,7 +72,7 @@ class PPCInstrInfo : public TargetInstrInfoImpl {
                             const TargetRegisterClass *RC,
                             SmallVectorImpl<MachineInstr*> &NewMIs) const;
 public:
-  PPCInstrInfo(PPCTargetMachine &TM);
+  explicit PPCInstrInfo(PPCTargetMachine &TM);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should
index 22b2dcd5916562fef0ee879b8ebb73842e483988..e9ce790a2a004e4ceb84c684d724f51c269e5ef6 100644 (file)
@@ -35,7 +35,7 @@ class SparcInstrInfo : public TargetInstrInfoImpl {
   const SparcRegisterInfo RI;
   const SparcSubtarget& Subtarget;
 public:
-  SparcInstrInfo(SparcSubtarget &ST);
+  explicit SparcInstrInfo(SparcSubtarget &ST);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should
index f4cdb706955e735bad53a4fb0995db1e4288a6ea..111eb8c1b558f31284d708e887682c39740104b8 100644 (file)
@@ -243,7 +243,7 @@ class X86InstrInfo : public TargetInstrInfoImpl {
   DenseMap<unsigned*, std::pair<unsigned, unsigned> > MemOp2RegOpTable;
   
 public:
-  X86InstrInfo(X86TargetMachine &tm);
+  explicit X86InstrInfo(X86TargetMachine &tm);
 
   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
   /// such, whenever a client has an instance of instruction info, it should
index 183e2f2bb81a448f6514bbcb87aaa33b8df33f21..69bebd0270cadc3f880333a28ac3403fb368d204 100644 (file)
@@ -23,7 +23,7 @@ namespace llvm {
     X86TargetMachine &TM;
     intptr_t PICBase;
   public:
-    X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;}
+    explicit X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;}
 
     /// replaceMachineCodeForFunction - Make it so that calling the function
     /// whose machine code is at OLD turns into a call to NEW, perhaps by
index 68e5ab40381df9a7fa63d303d1c652fb8601b695..4ac8c0f3a482426c8f920190de8fa79cae1b05ec 100644 (file)
@@ -118,16 +118,16 @@ namespace {  // Anonymous namespace for class
       : FunctionPass((intptr_t)&ID), 
       Broken(false), RealPass(true), action(AbortProcessAction),
       DT(0), msgs( std::ios::app | std::ios::out ) {}
-    Verifier( VerifierFailureAction ctn )
+    explicit Verifier(VerifierFailureAction ctn)
       : FunctionPass((intptr_t)&ID), 
       Broken(false), RealPass(true), action(ctn), DT(0),
       msgs( std::ios::app | std::ios::out ) {}
-    Verifier(bool AB )
+    explicit Verifier(bool AB)
       : FunctionPass((intptr_t)&ID), 
       Broken(false), RealPass(true),
       action( AB ? AbortProcessAction : PrintMessageAction), DT(0),
       msgs( std::ios::app | std::ios::out ) {}
-    Verifier(DominatorTree &dt)
+    explicit Verifier(DominatorTree &dt)
       : FunctionPass((intptr_t)&ID), 
       Broken(false), RealPass(false), action(PrintMessageAction),
       DT(&dt), msgs( std::ios::app | std::ios::out ) {}
index dc95e7981fd731070d4eed6f8605983b517163e6..70d88cea4500979bfc2a68e71d05861667813758 100644 (file)
@@ -2072,7 +2072,7 @@ void DAGISelEmitter::run(std::ostream &OS) {
   OS << "    std::vector<SDNode*> &ISelQueue;\n";
   OS << "    bool HadDelete;\n";
   OS << "  public:\n";
-  OS << "    ISelQueueUpdater(std::vector<SDNode*> &isq)\n";
+  OS << "    explicit ISelQueueUpdater(std::vector<SDNode*> &isq)\n";
   OS << "      : ISelQueue(isq), HadDelete(false) {}\n";
   OS << "    \n";
   OS << "    bool hadDelete() const { return HadDelete; }\n";
index 5f0e4c7fa679933e1eec81a36f91463847b2e947..83d358ad2ce746ed47cf96dba7e3ba6a09d72ba9 100644 (file)
@@ -509,7 +509,7 @@ public:
 class BitInit : public Init {
   bool Value;
 public:
-  BitInit(bool V) : Value(V) {}
+  explicit BitInit(bool V) : Value(V) {}
 
   bool getValue() const { return Value; }
 
@@ -526,7 +526,7 @@ public:
 class BitsInit : public Init {
   std::vector<Init*> Bits;
 public:
-  BitsInit(unsigned Size) : Bits(Size) {}
+  explicit BitsInit(unsigned Size) : Bits(Size) {}
 
   unsigned getNumBits() const { return Bits.size(); }
 
@@ -567,7 +567,7 @@ public:
 class IntInit : public Init {
   int Value;
 public:
-  IntInit(int V) : Value(V) {}
+  explicit IntInit(int V) : Value(V) {}
 
   int getValue() const { return Value; }
 
@@ -585,7 +585,7 @@ public:
 class StringInit : public Init {
   std::string Value;
 public:
-  StringInit(const std::string &V) : Value(V) {}
+  explicit StringInit(const std::string &V) : Value(V) {}
 
   const std::string &getValue() const { return Value; }
 
@@ -601,7 +601,7 @@ public:
 class CodeInit : public Init {
   std::string Value;
 public:
-  CodeInit(const std::string &V) : Value(V) {}
+  explicit CodeInit(const std::string &V) : Value(V) {}
 
   const std::string getValue() const { return Value; }
 
@@ -617,7 +617,7 @@ public:
 class ListInit : public Init {
   std::vector<Init*> Values;
 public:
-  ListInit(std::vector<Init*> &Vs) {
+  explicit ListInit(std::vector<Init*> &Vs) {
     Values.swap(Vs);
   }
 
@@ -693,7 +693,7 @@ public:
 class TypedInit : public Init {
   RecTy *Ty;
 public:
-  TypedInit(RecTy *T) : Ty(T) {}
+  explicit TypedInit(RecTy *T) : Ty(T) {}
 
   RecTy *getType() const { return Ty; }
 
@@ -719,7 +719,8 @@ public:
 class VarInit : public TypedInit {
   std::string VarName;
 public:
-  VarInit(const std::string &VN, RecTy *T) : TypedInit(T), VarName(VN) {}
+  explicit VarInit(const std::string &VN, RecTy *T)
+    : TypedInit(T), VarName(VN) {}
 
   virtual Init *convertInitializerTo(RecTy *Ty) {
     return Ty->convertValue(this);
@@ -807,7 +808,7 @@ public:
 class DefInit : public Init {
   Record *Def;
 public:
-  DefInit(Record *D) : Def(D) {}
+  explicit DefInit(Record *D) : Def(D) {}
 
   virtual Init *convertInitializerTo(RecTy *Ty) {
     return Ty->convertValue(this);
index 9577580e2a732855c502df5bccd952df4217e853..2e19202caa5313c91341db0bb8ae74fb75450f13 100644 (file)
@@ -58,7 +58,7 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
   OS << "namespace llvm {\n\n";
 
   OS << "struct " << ClassName << " : public TargetRegisterInfo {\n"
-     << "  " << ClassName
+     << "  explicit " << ClassName
      << "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
      << "  virtual int getDwarfRegNumFull(unsigned RegNum, "
      << "unsigned Flavour) const;\n"