[llvm-commits] CVS: llvm/include/llvm/Argument.h BasicBlock.h Constants.h DerivedTypes.h Module.h PassAnalysisSupport.h PassManager.h PassManagers.h PassSupport.h Type.h

Dan Gohman djg at cray.com
Fri Mar 23 11:44:36 PDT 2007



Changes in directory llvm/include/llvm:

Argument.h updated: 1.13 -> 1.14
BasicBlock.h updated: 1.62 -> 1.63
Constants.h updated: 1.139 -> 1.140
DerivedTypes.h updated: 1.88 -> 1.89
Module.h updated: 1.84 -> 1.85
PassAnalysisSupport.h updated: 1.28 -> 1.29
PassManager.h updated: 1.38 -> 1.39
PassManagers.h updated: 1.14 -> 1.15
PassSupport.h updated: 1.36 -> 1.37
Type.h updated: 1.104 -> 1.105
---
Log message:

Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.


---
Diffs of the changes:  (+25 -23)

 Argument.h            |    4 +++-
 BasicBlock.h          |    4 ++--
 Constants.h           |    6 +++---
 DerivedTypes.h        |    8 ++++----
 Module.h              |    2 +-
 PassAnalysisSupport.h |    2 +-
 PassManager.h         |    2 +-
 PassManagers.h        |    6 +++---
 PassSupport.h         |   10 +++++-----
 Type.h                |    4 ++--
 10 files changed, 25 insertions(+), 23 deletions(-)


Index: llvm/include/llvm/Argument.h
diff -u llvm/include/llvm/Argument.h:1.13 llvm/include/llvm/Argument.h:1.14
--- llvm/include/llvm/Argument.h:1.13	Sat Dec 16 23:15:12 2006
+++ llvm/include/llvm/Argument.h	Fri Mar 23 13:44:11 2007
@@ -41,7 +41,9 @@
   /// 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; }


Index: llvm/include/llvm/BasicBlock.h
diff -u llvm/include/llvm/BasicBlock.h:1.62 llvm/include/llvm/BasicBlock.h:1.63
--- llvm/include/llvm/BasicBlock.h:1.62	Sat Dec 16 23:15:12 2006
+++ llvm/include/llvm/BasicBlock.h	Fri Mar 23 13:44:11 2007
@@ -70,8 +70,8 @@
   /// 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


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.139 llvm/include/llvm/Constants.h:1.140
--- llvm/include/llvm/Constants.h:1.139	Mon Mar 19 15:39:08 2007
+++ llvm/include/llvm/Constants.h	Fri Mar 23 13:44:11 2007
@@ -231,7 +231,7 @@
   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 @@
   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 @@
   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.


Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.88 llvm/include/llvm/DerivedTypes.h:1.89
--- llvm/include/llvm/DerivedTypes.h:1.88	Wed Mar 21 19:32:02 2007
+++ llvm/include/llvm/DerivedTypes.h	Fri Mar 23 13:44:11 2007
@@ -36,7 +36,7 @@
   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 @@
 /// @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 @@
 /// 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 @@
   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);


Index: llvm/include/llvm/Module.h
diff -u llvm/include/llvm/Module.h:1.84 llvm/include/llvm/Module.h:1.85
--- llvm/include/llvm/Module.h:1.84	Sun Feb 11 23:00:35 2007
+++ llvm/include/llvm/Module.h	Fri Mar 23 13:44:11 2007
@@ -104,7 +104,7 @@
 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();
 


Index: llvm/include/llvm/PassAnalysisSupport.h
diff -u llvm/include/llvm/PassAnalysisSupport.h:1.28 llvm/include/llvm/PassAnalysisSupport.h:1.29
--- llvm/include/llvm/PassAnalysisSupport.h:1.28	Fri Jan  5 16:47:07 2007
+++ llvm/include/llvm/PassAnalysisSupport.h	Fri Mar 23 13:44:11 2007
@@ -111,7 +111,7 @@
   AnalysisResolver();  // DO NOT IMPLEMENT
 
 public:
-  AnalysisResolver(PMDataManager &P) : PM(P) { }
+  explicit AnalysisResolver(PMDataManager &P) : PM(P) { }
   
   inline PMDataManager &getPMDataManager() { return PM; }
 


Index: llvm/include/llvm/PassManager.h
diff -u llvm/include/llvm/PassManager.h:1.38 llvm/include/llvm/PassManager.h:1.39
--- llvm/include/llvm/PassManager.h:1.38	Fri Jan  5 14:16:23 2007
+++ llvm/include/llvm/PassManager.h	Fri Mar 23 13:44:11 2007
@@ -59,7 +59,7 @@
 /// FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
 class FunctionPassManager {
 public:
-  FunctionPassManager(ModuleProvider *P);
+  explicit FunctionPassManager(ModuleProvider *P);
   FunctionPassManager();
   ~FunctionPassManager();
  


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.14 llvm/include/llvm/PassManagers.h:1.15
--- llvm/include/llvm/PassManagers.h:1.14	Tue Mar  6 11:52:53 2007
+++ llvm/include/llvm/PassManagers.h	Fri Mar 23 13:44:11 2007
@@ -137,7 +137,7 @@
   /// 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 @@
 class PMDataManager {
 public:
 
-  PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
+  explicit PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
     initializeAnalysisInfo();
   }
 
@@ -321,7 +321,7 @@
 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.


Index: llvm/include/llvm/PassSupport.h
diff -u llvm/include/llvm/PassSupport.h:1.36 llvm/include/llvm/PassSupport.h:1.37
--- llvm/include/llvm/PassSupport.h:1.36	Fri Dec  1 17:46:50 2006
+++ llvm/include/llvm/PassSupport.h	Fri Mar 23 13:44:11 2007
@@ -193,20 +193,20 @@
   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);
   }


Index: llvm/include/llvm/Type.h
diff -u llvm/include/llvm/Type.h:1.104 llvm/include/llvm/Type.h:1.105
--- llvm/include/llvm/Type.h:1.104	Wed Feb 14 20:26:09 2007
+++ llvm/include/llvm/Type.h	Fri Mar 23 13:44:11 2007
@@ -103,8 +103,8 @@
   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());
   }






More information about the llvm-commits mailing list