[llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h Instructions.h SymbolTable.h

Reid Spencer reid at x10sys.com
Sun May 15 09:13:23 PDT 2005



Changes in directory llvm/include/llvm:

DerivedTypes.h updated: 1.67 -> 1.68
Instructions.h updated: 1.21 -> 1.22
SymbolTable.h updated: 1.50 -> 1.51
---
Log message:

Some cleanups for compilation with GCC 4.0.0 to remove warnings:
* Use C++ style casts, not C style casts
* Abstract base classes should have virtual destructor.


---
Diffs of the changes:  (+5 -5)

 DerivedTypes.h |    4 ++--
 Instructions.h |    4 ++--
 SymbolTable.h  |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/DerivedTypes.h
diff -u llvm/include/llvm/DerivedTypes.h:1.67 llvm/include/llvm/DerivedTypes.h:1.68
--- llvm/include/llvm/DerivedTypes.h:1.67	Thu Apr 21 15:11:51 2005
+++ llvm/include/llvm/DerivedTypes.h	Sun May 15 11:13:11 2005
@@ -141,7 +141,7 @@
   /// getNumParams - Return the number of fixed parameters this function type
   /// requires.  This does not consider varargs.
   ///
-  unsigned getNumParams() const { return (unsigned)ContainedTys.size()-1; }
+  unsigned getNumParams() const { return unsigned(ContainedTys.size()-1); }
 
   // Implement the AbstractTypeUser interface.
   virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
@@ -207,7 +207,7 @@
   element_iterator element_end() const { return ContainedTys.end(); }
 
   // Random access to the elements
-  unsigned getNumElements() const { return (unsigned)ContainedTys.size(); }
+  unsigned getNumElements() const { return unsigned(ContainedTys.size()); }
   const Type *getElementType(unsigned N) const {
     assert(N < ContainedTys.size() && "Element number out of range!");
     return ContainedTys[N];


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.21 llvm/include/llvm/Instructions.h:1.22
--- llvm/include/llvm/Instructions.h:1.21	Fri May  6 21:44:04 2005
+++ llvm/include/llvm/Instructions.h	Sun May 15 11:13:11 2005
@@ -519,7 +519,7 @@
   /// if it is a direct call.  If it is a call through a function pointer,
   /// return null.
   Function *getCalledFunction() const {
-    return (Function*)dyn_cast<Function>(getOperand(0));
+    return static_cast<Function*>(dyn_cast<Function>(getOperand(0)));
   }
 
   // getCalledValue - Get a pointer to a method that is invoked by this inst.
@@ -1153,7 +1153,7 @@
   // successor.
   inline ConstantInt *getSuccessorValue(unsigned idx) const {
     assert(idx < getNumSuccessors() && "Successor # out of range!");
-    return (ConstantInt*)getOperand(idx*2);
+    return reinterpret_cast<ConstantInt*>(getOperand(idx*2));
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:


Index: llvm/include/llvm/SymbolTable.h
diff -u llvm/include/llvm/SymbolTable.h:1.50 llvm/include/llvm/SymbolTable.h:1.51
--- llvm/include/llvm/SymbolTable.h:1.50	Thu Apr 21 15:11:51 2005
+++ llvm/include/llvm/SymbolTable.h	Sun May 15 11:13:11 2005
@@ -108,7 +108,7 @@
   inline bool isEmpty() const { return pmap.empty() && tmap.empty(); }
 
   /// @brief The number of name/type pairs is returned.
-  inline unsigned num_types() const { return (unsigned)tmap.size(); }
+  inline unsigned num_types() const { return unsigned(tmap.size()); }
 
   /// Given a base name, return a string that is either equal to it or
   /// derived from it that does not already occur in the symbol table






More information about the llvm-commits mailing list