summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2007-03-23 18:44:11 +0000
committerDan Gohman <gohman@apple.com>2007-03-23 18:44:11 +0000
commit423c2260f95883f7c84ac962e58ac66c3a11efac (patch)
treea1fe402ee6cad918ac07120290cef96670d64a63 /include/llvm
parentb819a2b5fef660298b4f38ce951dd7f679f66b4f (diff)
downloadllvm-423c2260f95883f7c84ac962e58ac66c3a11efac.tar.gz
llvm-423c2260f95883f7c84ac962e58ac66c3a11efac.tar.bz2
llvm-423c2260f95883f7c84ac962e58ac66c3a11efac.tar.xz
Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35280 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Argument.h4
-rw-r--r--include/llvm/BasicBlock.h4
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h7
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h2
-rw-r--r--include/llvm/CodeGen/MachineInstrBuilder.h2
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h3
-rw-r--r--include/llvm/CodeGen/MachineLocation.h2
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h3
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h10
-rw-r--r--include/llvm/Constants.h6
-rw-r--r--include/llvm/DerivedTypes.h8
-rw-r--r--include/llvm/Module.h2
-rw-r--r--include/llvm/PassAnalysisSupport.h2
-rw-r--r--include/llvm/PassManager.h2
-rw-r--r--include/llvm/PassManagers.h6
-rw-r--r--include/llvm/PassSupport.h10
-rw-r--r--include/llvm/Type.h4
17 files changed, 41 insertions, 36 deletions
diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h
index 1d92066ce5..8776a488aa 100644
--- a/include/llvm/Argument.h
+++ b/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/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index 0ca8eae1a3..e15a894591 100644
--- a/include/llvm/BasicBlock.h
+++ b/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/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index d076046407..1be1b742bf 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/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/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index ffd0e55663..1500053a12 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/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/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h
index 1d65a4692f..eb45b6ec1f 100644
--- a/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/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/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index 404ed15fd9..d440268e56 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/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<MachineBasicBlock*> MBBs;
- MachineJumpTableEntry(const std::vector<MachineBasicBlock*> &M) : MBBs(M) {}
+ explicit MachineJumpTableEntry(const std::vector<MachineBasicBlock*> &M)
+ : MBBs(M) {}
};
class MachineJumpTableInfo {
diff --git a/include/llvm/CodeGen/MachineLocation.h b/include/llvm/CodeGen/MachineLocation.h
index 023962dd6a..c0a78ae812 100644
--- a/include/llvm/CodeGen/MachineLocation.h
+++ b/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/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index 8557702018..6ffe86a41e 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -42,7 +42,8 @@ public:
std::vector<SDNode*> 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/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index d76e4b0813..5d1a0e3efb 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/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/include/llvm/Constants.h b/include/llvm/Constants.h
index c307356247..86fc2e7018 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -231,7 +231,7 @@ class ConstantAggregateZero : public Constant {
friend struct ConstantCreator<ConstantAggregateZero, Type, char>;
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, PointerType, char>;
ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT
protected:
- ConstantPointerNull(const PointerType *T)
+ explicit ConstantPointerNull(const PointerType *T)
: Constant(reinterpret_cast<const Type*>(T),
Value::ConstantPointerNullVal, 0, 0) {}
@@ -669,7 +669,7 @@ class UndefValue : public Constant {
friend struct ConstantCreator<UndefValue, Type, char>;
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/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 4b24d876be..21ff3d690f 100644
--- a/include/llvm/DerivedTypes.h
+++ b/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<IntegerValType, IntegerType>;
@@ -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<PointerValType, PointerType>;
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/include/llvm/Module.h b/include/llvm/Module.h
index 560554e3d0..3d68e736bf 100644
--- a/include/llvm/Module.h
+++ b/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/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h
index d832485b83..3234e91eba 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/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/include/llvm/PassManager.h b/include/llvm/PassManager.h
index f1178e07d3..254cac94d1 100644
--- a/include/llvm/PassManager.h
+++ b/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/include/llvm/PassManagers.h b/include/llvm/PassManagers.h
index fd78833a85..c94a098a84 100644
--- a/include/llvm/PassManagers.h
+++ b/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/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index e4144f7e42..c4d75d52ee 100644
--- a/include/llvm/PassSupport.h
+++ b/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<typename Interface, bool Default = false>
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/include/llvm/Type.h b/include/llvm/Type.h
index 880daadfb1..439ac18bf4 100644
--- a/include/llvm/Type.h
+++ b/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());
}