diff --git a/llvm/include/llvm/Argument.h b/llvm/include/llvm/Argument.h index 1d92066ce582..8776a488aadc 100644 --- a/llvm/include/llvm/Argument.h +++ b/llvm/include/llvm/Argument.h @@ -41,7 +41,9 @@ public: /// Argument ctor - If Function argument is specified, this argument is /// inserted at the end of the argument list for the function. /// - Argument(const Type *Ty, const std::string &Name = "", Function *F = 0); + explicit Argument(const Type *Ty, + const std::string &Name = "", + Function *F = 0); inline const Function *getParent() const { return Parent; } inline Function *getParent() { return Parent; } diff --git a/llvm/include/llvm/BasicBlock.h b/llvm/include/llvm/BasicBlock.h index 0ca8eae1a3ef..e15a89459140 100644 --- a/llvm/include/llvm/BasicBlock.h +++ b/llvm/include/llvm/BasicBlock.h @@ -70,8 +70,8 @@ public: /// is automatically inserted at either the end of the function (if /// InsertBefore is null), or before the specified basic block. /// - BasicBlock(const std::string &Name = "", Function *Parent = 0, - BasicBlock *InsertBefore = 0); + explicit BasicBlock(const std::string &Name = "", Function *Parent = 0, + BasicBlock *InsertBefore = 0); ~BasicBlock(); /// getParent - Return the enclosing method, or null if none diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h index d076046407f2..1be1b742bf88 100644 --- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -79,9 +79,10 @@ class MachineBasicBlock { bool IsLandingPad; public: - MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb), - Number(-1), Parent(0), - IsLandingPad(false) { + explicit MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), + BB(bb), Number(-1), + Parent(0), + IsLandingPad(false) { Insts.parent = this; } diff --git a/llvm/include/llvm/CodeGen/MachineConstantPool.h b/llvm/include/llvm/CodeGen/MachineConstantPool.h index ffd0e5566346..1500053a125d 100644 --- a/llvm/include/llvm/CodeGen/MachineConstantPool.h +++ b/llvm/include/llvm/CodeGen/MachineConstantPool.h @@ -35,7 +35,7 @@ class MachineConstantPoolValue { const Type *Ty; public: - MachineConstantPoolValue(const Type *ty) : Ty(ty) {} + explicit MachineConstantPoolValue(const Type *ty) : Ty(ty) {} virtual ~MachineConstantPoolValue() {}; /// getType - get type of this MachineConstantPoolValue. diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h index 1d65a4692ff3..eb45b6ec1fa6 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h @@ -27,7 +27,7 @@ class TargetInstrDescriptor; class MachineInstrBuilder { MachineInstr *MI; public: - MachineInstrBuilder(MachineInstr *mi) : MI(mi) {} + explicit MachineInstrBuilder(MachineInstr *mi) : MI(mi) {} /// Allow automatic conversion to the machine instruction we are working on. /// diff --git a/llvm/include/llvm/CodeGen/MachineJumpTableInfo.h b/llvm/include/llvm/CodeGen/MachineJumpTableInfo.h index 404ed15fd985..d440268e565d 100644 --- a/llvm/include/llvm/CodeGen/MachineJumpTableInfo.h +++ b/llvm/include/llvm/CodeGen/MachineJumpTableInfo.h @@ -34,7 +34,8 @@ struct MachineJumpTableEntry { /// MBBs - The vector of basic blocks from which to create the jump table. std::vector MBBs; - MachineJumpTableEntry(const std::vector &M) : MBBs(M) {} + explicit MachineJumpTableEntry(const std::vector &M) + : MBBs(M) {} }; class MachineJumpTableInfo { diff --git a/llvm/include/llvm/CodeGen/MachineLocation.h b/llvm/include/llvm/CodeGen/MachineLocation.h index 023962dd6af1..c0a78ae812fa 100644 --- a/llvm/include/llvm/CodeGen/MachineLocation.h +++ b/llvm/include/llvm/CodeGen/MachineLocation.h @@ -40,7 +40,7 @@ public: , Register(0) , Offset(0) {} - MachineLocation(unsigned R) + explicit MachineLocation(unsigned R) : IsRegister(true) , Register(R) , Offset(0) diff --git a/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/llvm/include/llvm/CodeGen/SelectionDAGISel.h index 8557702018f7..6ffe86a41e81 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGISel.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGISel.h @@ -42,7 +42,8 @@ public: std::vector TopOrder; unsigned DAGSize; - SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0), JT(0,0,0,0) {} + explicit SelectionDAGISel(TargetLowering &tli) + : TLI(tli), DAGSize(0), JT(0,0,0,0) {} TargetLowering &getTargetLowering() { return TLI; } diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index d76e4b081398..5d1a0e3efb4f 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1075,7 +1075,7 @@ class HandleSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. SDOperand Op; public: - HandleSDNode(SDOperand X) + explicit HandleSDNode(SDOperand X) : SDNode(ISD::HANDLENODE, getSDVTList(MVT::Other)), Op(X) { InitOperands(&Op, 1); } @@ -1088,7 +1088,7 @@ class StringSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - StringSDNode(const std::string &val) + explicit StringSDNode(const std::string &val) : SDNode(ISD::STRING, getSDVTList(MVT::Other)), Value(val) { } public: @@ -1298,7 +1298,7 @@ class BasicBlockSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - BasicBlockSDNode(MachineBasicBlock *mbb) + explicit BasicBlockSDNode(MachineBasicBlock *mbb) : SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) { } public: @@ -1375,7 +1375,7 @@ class CondCodeSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - CondCodeSDNode(ISD::CondCode Cond) + explicit CondCodeSDNode(ISD::CondCode Cond) : SDNode(ISD::CONDCODE, getSDVTList(MVT::Other)), Condition(Cond) { } public: @@ -1395,7 +1395,7 @@ class VTSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - VTSDNode(MVT::ValueType VT) + explicit VTSDNode(MVT::ValueType VT) : SDNode(ISD::VALUETYPE, getSDVTList(MVT::Other)), ValueType(VT) { } public: diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h index c307356247ce..86fc2e701814 100644 --- a/llvm/include/llvm/Constants.h +++ b/llvm/include/llvm/Constants.h @@ -231,7 +231,7 @@ class ConstantAggregateZero : public Constant { friend struct ConstantCreator; ConstantAggregateZero(const ConstantAggregateZero &); // DO NOT IMPLEMENT protected: - ConstantAggregateZero(const Type *Ty) + explicit ConstantAggregateZero(const Type *Ty) : Constant(Ty, ConstantAggregateZeroVal, 0, 0) {} public: /// get() - static factory method for creating a null aggregate. It is @@ -420,7 +420,7 @@ class ConstantPointerNull : public Constant { friend struct ConstantCreator; ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT protected: - ConstantPointerNull(const PointerType *T) + explicit ConstantPointerNull(const PointerType *T) : Constant(reinterpret_cast(T), Value::ConstantPointerNullVal, 0, 0) {} @@ -669,7 +669,7 @@ class UndefValue : public Constant { friend struct ConstantCreator; UndefValue(const UndefValue &); // DO NOT IMPLEMENT protected: - UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {} + explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {} public: /// get() - Static factory methods - Return an 'undef' object of the specified /// type. diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h index 4b24d876beef..21ff3d690f8c 100644 --- a/llvm/include/llvm/DerivedTypes.h +++ b/llvm/include/llvm/DerivedTypes.h @@ -36,7 +36,7 @@ class DerivedType : public Type { friend class Type; protected: - DerivedType(TypeID id) : Type(id) {} + explicit DerivedType(TypeID id) : Type(id) {} /// notifyUsesThatTypeBecameConcrete - Notify AbstractTypeUsers of this type /// that the current type has transitioned from being abstract to being @@ -79,7 +79,7 @@ public: /// @brief Integer representation type class IntegerType : public DerivedType { protected: - IntegerType(unsigned NumBits) : DerivedType(IntegerTyID) { + explicit IntegerType(unsigned NumBits) : DerivedType(IntegerTyID) { setSubclassData(NumBits); } friend class TypeMap; @@ -230,7 +230,7 @@ public: /// and VectorType class CompositeType : public DerivedType { protected: - inline CompositeType(TypeID id) : DerivedType(id) { } + inline explicit CompositeType(TypeID id) : DerivedType(id) { } public: /// getTypeAtIndex - Given an index value into the type, return the type of @@ -404,7 +404,7 @@ class PointerType : public SequentialType { friend class TypeMap; PointerType(const PointerType &); // Do not implement const PointerType &operator=(const PointerType &); // Do not implement - PointerType(const Type *ElType); + explicit PointerType(const Type *ElType); public: /// PointerType::get - This is the only way to construct a new pointer type. static PointerType *get(const Type *ElementType); diff --git a/llvm/include/llvm/Module.h b/llvm/include/llvm/Module.h index 560554e3d0db..3d68e736bfc4 100644 --- a/llvm/include/llvm/Module.h +++ b/llvm/include/llvm/Module.h @@ -104,7 +104,7 @@ private: public: /// The Module constructor. Note that there is no default constructor. You /// must provide a name for the module upon construction. - Module(const std::string &ModuleID); + explicit Module(const std::string &ModuleID); /// The module destructor. This will dropAllReferences. ~Module(); diff --git a/llvm/include/llvm/PassAnalysisSupport.h b/llvm/include/llvm/PassAnalysisSupport.h index d832485b833c..3234e91ebacc 100644 --- a/llvm/include/llvm/PassAnalysisSupport.h +++ b/llvm/include/llvm/PassAnalysisSupport.h @@ -111,7 +111,7 @@ private: AnalysisResolver(); // DO NOT IMPLEMENT public: - AnalysisResolver(PMDataManager &P) : PM(P) { } + explicit AnalysisResolver(PMDataManager &P) : PM(P) { } inline PMDataManager &getPMDataManager() { return PM; } diff --git a/llvm/include/llvm/PassManager.h b/llvm/include/llvm/PassManager.h index f1178e07d3b0..254cac94d10e 100644 --- a/llvm/include/llvm/PassManager.h +++ b/llvm/include/llvm/PassManager.h @@ -59,7 +59,7 @@ private: /// FunctionPassManager manages FunctionPasses and BasicBlockPassManagers. class FunctionPassManager { public: - FunctionPassManager(ModuleProvider *P); + explicit FunctionPassManager(ModuleProvider *P); FunctionPassManager(); ~FunctionPassManager(); diff --git a/llvm/include/llvm/PassManagers.h b/llvm/include/llvm/PassManagers.h index fd78833a85aa..c94a098a842f 100644 --- a/llvm/include/llvm/PassManagers.h +++ b/llvm/include/llvm/PassManagers.h @@ -137,7 +137,7 @@ public: /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); - PMTopLevelManager(enum TopLevelManagerType t); + explicit PMTopLevelManager(enum TopLevelManagerType t); virtual ~PMTopLevelManager(); /// Add immutable pass and initialize it. @@ -198,7 +198,7 @@ private: class PMDataManager { public: - PMDataManager(int Depth) : TPM(NULL), Depth(Depth) { + explicit PMDataManager(int Depth) : TPM(NULL), Depth(Depth) { initializeAnalysisInfo(); } @@ -321,7 +321,7 @@ private: class FPPassManager : public ModulePass, public PMDataManager { public: - FPPassManager(int Depth) : PMDataManager(Depth) { } + explicit FPPassManager(int Depth) : PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. diff --git a/llvm/include/llvm/PassSupport.h b/llvm/include/llvm/PassSupport.h index e4144f7e4224..c4d75d52ee15 100644 --- a/llvm/include/llvm/PassSupport.h +++ b/llvm/include/llvm/PassSupport.h @@ -193,20 +193,20 @@ class RegisterAGBase : public RegisterPassBase { const PassInfo *ImplementationInfo; bool isDefaultImplementation; protected: - RegisterAGBase(const std::type_info &Interface, - const std::type_info *Pass = 0, - bool isDefault = false); + explicit RegisterAGBase(const std::type_info &Interface, + const std::type_info *Pass = 0, + bool isDefault = false); void setGroupName(const char *Name); }; template struct RegisterAnalysisGroup : public RegisterAGBase { - RegisterAnalysisGroup(RegisterPassBase &RPB) + explicit RegisterAnalysisGroup(RegisterPassBase &RPB) : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(), Default) { } - RegisterAnalysisGroup(const char *Name) + explicit RegisterAnalysisGroup(const char *Name) : RegisterAGBase(typeid(Interface)) { setGroupName(Name); } diff --git a/llvm/include/llvm/Type.h b/llvm/include/llvm/Type.h index 880daadfb172..439ac18bf4ce 100644 --- a/llvm/include/llvm/Type.h +++ b/llvm/include/llvm/Type.h @@ -103,8 +103,8 @@ private: const Type *getForwardedTypeInternal() const; protected: Type(const char *Name, TypeID id); - Type(TypeID id) : ID(id), Abstract(false), SubclassData(0), RefCount(0), - ForwardType(0) {} + explicit Type(TypeID id) : ID(id), Abstract(false), SubclassData(0), + RefCount(0), ForwardType(0) {} virtual ~Type() { assert(AbstractTypeUsers.empty()); }