Add explicit keywords.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/ADT/SmallPtrSet.h b/include/llvm/ADT/SmallPtrSet.h
index e165d14..8b85a67 100644
--- a/include/llvm/ADT/SmallPtrSet.h
+++ b/include/llvm/ADT/SmallPtrSet.h
@@ -57,7 +57,7 @@
   // 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 @@
 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 @@
 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.
   
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 80088fd..8d333de 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -48,7 +48,7 @@
 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 @@
   }
 
 public:
-  DominatorTreeBase(bool isPostDom) 
+  explicit DominatorTreeBase(bool isPostDom)
     : DominatorBase<NodeT>(isPostDom), DFSInfoValid(false), SlowQueries(0) {}
   virtual ~DominatorTreeBase() { reset(); }
 
diff --git a/include/llvm/ModuleProvider.h b/include/llvm/ModuleProvider.h
index 17ff6b2..65bcc76 100644
--- a/include/llvm/ModuleProvider.h
+++ b/include/llvm/ModuleProvider.h
@@ -74,7 +74,7 @@
 /// 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) {
diff --git a/include/llvm/Use.h b/include/llvm/Use.h
index c81a903..48384f2 100644
--- a/include/llvm/Use.h
+++ b/include/llvm/Use.h
@@ -107,7 +107,7 @@
   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;
diff --git a/lib/AsmParser/LLLexer.h b/lib/AsmParser/LLLexer.h
index 7eaa9f9..8b44b14 100644
--- a/lib/AsmParser/LLLexer.h
+++ b/lib/AsmParser/LLLexer.h
@@ -30,7 +30,7 @@
     
     std::string TheError;
   public:
-    LLLexer(MemoryBuffer *StartBuf);
+    explicit LLLexer(MemoryBuffer *StartBuf);
     ~LLLexer() {}
 
     const char *getTokStart() const { return TokStart; }
diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h
index 9a140d9..86b00a5 100644
--- a/lib/Bitcode/Reader/BitcodeReader.h
+++ b/lib/Bitcode/Reader/BitcodeReader.h
@@ -117,7 +117,8 @@
   /// 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() {
diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h
index bf1e804..69e301b 100644
--- a/lib/ExecutionEngine/JIT/JIT.h
+++ b/lib/ExecutionEngine/JIT/JIT.h
@@ -37,7 +37,7 @@
   std::vector<const GlobalVariable*> PendingGlobals;
 
 public:
-  JITState(ModuleProvider *MP) : PM(MP) {}
+  explicit JITState(ModuleProvider *MP) : PM(MP) {}
 
   FunctionPassManager &getPM(const MutexGuard &L) {
     return PM;
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index b675811..8d5a94a 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -96,7 +96,7 @@
 
     static JITResolver *TheJITResolver;
   public:
-    JITResolver(JIT &jit) : nextGOTIndex(0) {
+    explicit JITResolver(JIT &jit) : nextGOTIndex(0) {
       TheJIT = &jit;
 
       LazyResolverFn = jit.getJITInfo().getLazyResolverFunction(JITCompilerFn);
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
index b3f32e8..24f220d 100644
--- a/lib/Support/CommandLine.cpp
+++ b/lib/Support/CommandLine.cpp
@@ -931,7 +931,7 @@
   }
 
 public:
-  HelpPrinter(bool showHidden) : ShowHidden(showHidden) {
+  explicit HelpPrinter(bool showHidden) : ShowHidden(showHidden) {
     EmptyArg = 0;
   }
 
diff --git a/lib/Target/ARM/ARMInstrInfo.h b/lib/Target/ARM/ARMInstrInfo.h
index 4ce90fc..29ec8be 100644
--- a/lib/Target/ARM/ARMInstrInfo.h
+++ b/lib/Target/ARM/ARMInstrInfo.h
@@ -128,7 +128,7 @@
 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
diff --git a/lib/Target/ARM/ARMJITInfo.h b/lib/Target/ARM/ARMJITInfo.h
index 2004879..81d896b 100644
--- a/lib/Target/ARM/ARMJITInfo.h
+++ b/lib/Target/ARM/ARMJITInfo.h
@@ -22,7 +22,7 @@
   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
diff --git a/lib/Target/Alpha/AlphaJITInfo.h b/lib/Target/Alpha/AlphaJITInfo.h
index a12f546..2951169 100644
--- a/lib/Target/Alpha/AlphaJITInfo.h
+++ b/lib/Target/Alpha/AlphaJITInfo.h
@@ -26,7 +26,7 @@
   protected:
     TargetMachine &TM;
   public:
-    AlphaJITInfo(TargetMachine &tm) : TM(tm)
+    explicit AlphaJITInfo(TargetMachine &tm) : TM(tm)
     { useGOT = true; }
 
     virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE);
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 24ac8f9..b05c569 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -90,7 +90,7 @@
 
   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) {}
 
diff --git a/lib/Target/CellSPU/SPUInstrInfo.h b/lib/Target/CellSPU/SPUInstrInfo.h
index c5fe811..dc49202 100644
--- a/lib/Target/CellSPU/SPUInstrInfo.h
+++ b/lib/Target/CellSPU/SPUInstrInfo.h
@@ -24,7 +24,7 @@
     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
diff --git a/lib/Target/Mips/MipsInstrInfo.h b/lib/Target/Mips/MipsInstrInfo.h
index a186f2c..9842414 100644
--- a/lib/Target/Mips/MipsInstrInfo.h
+++ b/lib/Target/Mips/MipsInstrInfo.h
@@ -46,7 +46,7 @@
   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
diff --git a/lib/Target/PowerPC/PPCInstrInfo.h b/lib/Target/PowerPC/PPCInstrInfo.h
index e659129..d74399d 100644
--- a/lib/Target/PowerPC/PPCInstrInfo.h
+++ b/lib/Target/PowerPC/PPCInstrInfo.h
@@ -72,7 +72,7 @@
                             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
diff --git a/lib/Target/Sparc/SparcInstrInfo.h b/lib/Target/Sparc/SparcInstrInfo.h
index 22b2dcd..e9ce790 100644
--- a/lib/Target/Sparc/SparcInstrInfo.h
+++ b/lib/Target/Sparc/SparcInstrInfo.h
@@ -35,7 +35,7 @@
   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
diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h
index f4cdb70..111eb8c 100644
--- a/lib/Target/X86/X86InstrInfo.h
+++ b/lib/Target/X86/X86InstrInfo.h
@@ -243,7 +243,7 @@
   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
diff --git a/lib/Target/X86/X86JITInfo.h b/lib/Target/X86/X86JITInfo.h
index 183e2f2..69bebd0 100644
--- a/lib/Target/X86/X86JITInfo.h
+++ b/lib/Target/X86/X86JITInfo.h
@@ -23,7 +23,7 @@
     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
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 68e5ab4..4ac8c0f 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -118,16 +118,16 @@
       : 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 ) {}
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index dc95e79..70d88ce 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -2072,7 +2072,7 @@
   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";
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 5f0e4c7..83d358a 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -509,7 +509,7 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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);
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp
index 9577580..2e19202 100644
--- a/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/utils/TableGen/RegisterInfoEmitter.cpp
@@ -58,7 +58,7 @@
   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"